Function magnus::rb_sys::resume_error

source ·
pub unsafe fn resume_error(e: Error) -> !
Available on crate feature rb-sys-interop only.
Expand description

Resumes an Error previously caught by protect.

All functions exposed by Magnus where it is safe to resume an error use this internally to automatically convert returned errors to raised exceptions. This should only be required to in functions/closures given directly to rb-sys.

Safety

Beware this function does not return and breaks the normal assumption that Rust code does not unwind during normal behaviour. This can break invariants in code that assumes unwinding only happens during terminating panics.

If possible, only call this at the very end of a function/closure that is directly called by Ruby, not other Rust code, and ensure all other values in scope have been dropped before calling this function.