relay_log

Function capture_error

pub fn capture_error<E>(error: &E) -> Uuid
where E: Error + ?Sized,
Expand description

Captures a std::error::Error.

Creates an event from the given error and sends it to the current hub. A chain of errors will be resolved as well, and sorted oldest to newest, as described in the sentry event payloads.

ยงExamples

let err = "NaN".parse::<usize>().unwrap_err();

sentry::capture_error(&err);

assert_eq!(captured_event.exception.len(), 1);
assert_eq!(&captured_event.exception[0].ty, "ParseIntError");