mirror of
https://github.com/servo/servo.git
synced 2025-07-08 16:03:40 +01:00
Auto merge of #12733 - nox:panic-location, r=jdm
Print thread name and file location when panicking <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12733) <!-- Reviewable:end -->
This commit is contained in:
commit
aced80b56d
1 changed files with 8 additions and 1 deletions
|
@ -41,6 +41,7 @@ use servo::util::servo_version;
|
||||||
use std::panic;
|
use std::panic;
|
||||||
use std::process;
|
use std::process;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::thread;
|
||||||
|
|
||||||
pub mod platform {
|
pub mod platform {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
|
@ -107,7 +108,13 @@ fn main() {
|
||||||
None => "Box<Any>",
|
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();
|
setup_logging();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue