mirror of
https://git.proxmox.com/git/perlmod
synced 2025-10-04 21:26:38 +00:00
macro: wrap xs calls in std::panic::catch_unwind
This causes panics to "croak" in perl, rather than aborting the entire process. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
95d8d56b0a
commit
d7a1add485
@ -290,7 +290,15 @@ pub fn handle_function(
|
|||||||
argmark.set_stack();
|
argmark.set_stack();
|
||||||
}
|
}
|
||||||
|
|
||||||
#handle_return
|
let res = std::panic::catch_unwind(move || {
|
||||||
|
#handle_return
|
||||||
|
});
|
||||||
|
match res {
|
||||||
|
Ok(res) => res,
|
||||||
|
Err(_panic) => Err(::perlmod::Value::new_string("rust function panicked")
|
||||||
|
.into_mortal()
|
||||||
|
.into_raw()),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user