|
@@ -11,6 +11,7 @@ use hash::{Cache, RepetitionTable};
|
|
|
|
|
|
use std::sync::Arc;
|
|
|
use std::sync::mpsc::{Receiver, Sender};
|
|
|
+use std::panic;
|
|
|
|
|
|
///
|
|
|
/// Message types that are sent from the uci interface to the engine thread.
|
|
@@ -95,6 +96,13 @@ impl Engine {
|
|
|
}
|
|
|
|
|
|
pub fn run(&mut self) {
|
|
|
+ panic::set_hook(Box::new(|panic_info| {
|
|
|
+ if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
|
|
|
+ info!("panic occurred: {s:?}");
|
|
|
+ } else {
|
|
|
+ info!("panic occurred");
|
|
|
+ }
|
|
|
+ }));
|
|
|
while let Some(msg) = self.dequeue_message() {
|
|
|
match msg {
|
|
|
EngineMsg::SetBoard{ pos, moves } => {
|