nesdie icon indicating copy to clipboard operation
nesdie copied to clipboard

Panic handler does not work

Open hanakannzashi opened this issue 2 years ago • 1 comments

These code does not work

if let Some(s) = info.payload().downcast_ref::<&str>() {
    env::panic_str(s);
} else {
    env::panic_str("unexpected panic occurred");
}

Always execute else branch when custom panic happen.

#[no_mangle]
pub extern "C" fn test() {
    None.expect("Custom panic message"); // We can not get this message
}

hanakannzashi avatar May 01 '23 08:05 hanakannzashi

Hacktober

rathiraghav00 avatar Oct 30 '21 09:10 rathiraghav00