Print thread name and file location when panicking

This commit is contained in:
Anthony Ramine 2016-08-04 16:53:53 +02:00
parent 41cb4f4c77
commit 164a9f626b

View file

@ -41,6 +41,7 @@ use servo::util::servo_version;
use std::panic;
use std::process;
use std::rc::Rc;
use std::thread;
pub mod platform {
#[cfg(target_os = "macos")]
@ -107,7 +108,13 @@ fn main() {
None => "Box<Any>",
},
};
error!("{}", msg);
let current_thread = thread::current();
let name = current_thread.name().unwrap_or("<unnamed>");
if let Some(location) = info.location() {
error!("{} (thread {}, at {}:{})", msg, name, location.file(), location.line());
} else {
error!("{} (thread {})", msg, name);
}
}));
setup_logging();