Function try_catch

Source
pub fn try_catch<R, F: FnMut() -> R + RefUnwindSafe>(
    func: F,
) -> Result<R, CatchError>
Expand description

PHP proposes a try catch mechanism in C using setjmp and longjmp (bailout) It stores the arg of setjmp into the bailout field of the global executor If a bailout is triggered, the executor will jump to the setjmp and restore the previous setjmp

try_catch allows to use this mechanism

§Returns

  • The result of the function

§Errors

  • CatchError - A bailout occurred during the execution