Skip to content

Commit cffc188

Browse files
committed
wasm: fix PanicMessage following rust-lang/rust#66745
1 parent 6a4d40e commit cffc188

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/wasm.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,16 @@ fn console_error(s: &str) {
6262

6363
#[panic_handler]
6464
fn panic(panic_info: &core::panic::PanicInfo<'_>) -> ! {
65-
if let Some(message) = panic_info.message() {
66-
if let Some(location) = panic_info.location() {
67-
console_error(&format!(
68-
"panic: {message} ({}:{}:{})",
69-
location.file(),
70-
location.line(),
71-
location.column()
72-
));
73-
} else {
74-
console_error(&format!("panic: {message:?}"));
75-
}
65+
if let Some(location) = panic_info.location() {
66+
console_error(&format!(
67+
"panic: {} ({}:{}:{})",
68+
panic_info.message(),
69+
location.file(),
70+
location.line(),
71+
location.column()
72+
));
73+
} else {
74+
console_error(&format!("panic: {:?}", panic_info.message()));
7675
}
7776
core::arch::wasm32::unreachable()
7877
}

0 commit comments

Comments
 (0)