mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added unpacking
to panic messages, issue #83 Former-commit-id: 55b45773d049834a7a6cf43bbdf656cba7290f74
This commit is contained in:
parent
6699d7cba2
commit
1cfd0de2ba
@ -101,6 +101,18 @@ fn main() {
|
||||
let settings_clone = settings.clone();
|
||||
let default_hook = panic::take_hook();
|
||||
panic::set_hook(Box::new(move |panic_info| {
|
||||
let panic_info_payload = panic_info.payload();
|
||||
let payload_string = panic_info_payload.downcast_ref::<String>();
|
||||
let reason = match payload_string {
|
||||
Some(s) => &s,
|
||||
None => {
|
||||
let payload_str = panic_info_payload.downcast_ref::<&str>();
|
||||
match payload_str {
|
||||
Some(st) => st,
|
||||
None => "Payload is not a string",
|
||||
}
|
||||
}
|
||||
};
|
||||
let msg = format!(" \
|
||||
A critical error has occured and Voxygen has been forced to terminate in an unusual manner. Details about the error can be found below.
|
||||
|
||||
@ -122,7 +134,8 @@ Voxygen has logged information about the problem (including this message) to the
|
||||
|
||||
The information below is intended for developers and testers.
|
||||
|
||||
{:?}", settings_clone.log.file, panic_info);
|
||||
Panic Payload: {:?}
|
||||
PanicInfo: {:?}", settings_clone.log.file, reason, panic_info);
|
||||
|
||||
log::error!("VOXYGEN HAS PANICKED\n\n{}", msg);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user