darkwing

Macro unreachable_if_err

source
macro_rules! unreachable_if_err {
    ($value:expr) => { ... };
}
Expand description

Unwraps a Result, capturing any error with Sentry and panicking if it’s an Err.

This macro is intended for use in situations where an error is unexpected and should be treated as a critical failure, but should still be reported to Sentry before the program terminates.

§Examples

let result: Result<i32, &str> = Ok(42);
let unwrapped = unreachable_if_err!(result);
assert_eq!(unwrapped, 42);

§Panics

Panics with unreachable!() after capturing the error with Sentry if the Result is an Err.