[][src]Macro replicante_util_failure::capture_fail

macro_rules! capture_fail {
    ($error:expr, $($args:tt)+) => { ... };
}

Capture a Fail and prevent propagation.

The main purpose is to provide a standard and reusable logic for dealing with errors that should be reported but not propagated.

Fails are:

  • Reported to sentry (if enabled)
  • Logged to the provided logger.

Example

This example is not tested
use replicante_util_failure::capture_fail;
use replicante_util_failure::failure_info;

capture_fail!(&error, logger, "logging: {}", "test");
capture_fail!(&error, logger, "logging: {}", "test"; "key" => ?"value");
capture_fail!(&error, logger, "logging: {}", "test"; failure_info(&error));