Module sentry::integrations::failure [] [src]

Adds support for the failure crate.

Feature: with_failure (enabled by default)

Failure errors and Fail objects can be logged with the failure integration. This works really well if you use the failure::Error type or if you have failure::Fail objects that use the failure context internally to gain a backtrace.

Example

use sentry::integrations::failure::capture_error;
let result = match function_that_might_fail() {
    Ok(result) => result,
    Err(err) => {
        capture_error(&err);
        return Err(err);
    }
};

Tapping

For convenience you can also use the tapping feature where an error is logged but passed through a call. So the above example can also be written like this:

use sentry::integrations::failure::tap_error;
let result = tap_error(function_that_might_fail())?;

To capture fails and not errors use capture_fail.

Functions

capture_error

Captures a boxed failure (failure::Error).

capture_fail

Captures a failure::Fail.

event_from_error

Helper function to create an event from a failure::Error.

event_from_fail

Helper function to create an event from a failure::Fail.

tap_error

Log a result of failure::Error but return the value unchanged.

tap_fail

Log a result of failure::Fail but return the value unchanged.