pub struct InFlightException<E>(/* private fields */);
Expand description
Not-quite-caught exception.
This type is returned by intercept
when an exception is caught. Exception handling is not
yet done at that point: it’s akin to entering a catch
clause in C++.
At this point, you can either drop the handle, which halts the Lithium machinery and brings you
back to the sane land of Result
, or call InFlightException::rethrow
to piggy-back on the
contexts of the caught exception.
Implementations§
Source§impl<E> InFlightException<E>
impl<E> InFlightException<E>
Sourcepub unsafe fn rethrow<F>(self, new_cause: F) -> !
pub unsafe fn rethrow<F>(self, new_cause: F) -> !
Throw a new exception by reusing the existing context.
See intercept
docs for examples and safety notes.
§Safety
See the safety section of this crate for information on matching types.
In addition, the caller must ensure that the exception can only be caught by Lithium
functions and not by the system runtime. The list of banned functions includes
std::panic::catch_unwind
and std::thread::spawn
.
For this reason, the caller must ensure no frames between rethrow
and catch
can catch
the exception. This includes not passing throwing callbacks to foreign crates, but also not
using rethrow
in own code that might intercept
an exception without cooperation with
the throwing side.