Skip to content

Commit 343c542

Browse files
committed
fix(lab/4): panic handler
1 parent 8f7ad95 commit 343c542

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/0x04/pkg/lib/src/macros.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ macro_rules! entry {
1717
fn panic(info: &core::panic::PanicInfo) -> ! {
1818
let location = if let Some(location) = info.location() {
1919
alloc::format!(
20-
"{}:{}:{}",
20+
"{}@{}:{}",
2121
location.file(),
2222
location.line(),
2323
location.column()
2424
)
2525
} else {
2626
"Unknown location".to_string()
2727
};
28-
let msg = if let Some(msg) = info.message() {
29-
alloc::format!("{}", msg)
30-
} else {
31-
"No more message...".to_string()
32-
};
33-
errln!("\n\n\rERROR: panicked at {}\n\n\r{}", location, msg);
28+
29+
errln!(
30+
"\n\n\rERROR: panicked at {}\n\n\r{}",
31+
location,
32+
info.message()
33+
);
3434

3535
// FIXME: after syscall, add lib::sys_exit(1);
3636
loop {}

0 commit comments

Comments
 (0)