autopush_common::errors

Trait ReportableError

source
pub trait ReportableError: Error {
    // Provided methods
    fn reportable_source(&self) -> Option<&(dyn ReportableError + 'static)> { ... }
    fn backtrace(&self) -> Option<&Backtrace> { ... }
    fn is_sentry_event(&self) -> bool { ... }
    fn metric_label(&self) -> Option<&'static str> { ... }
    fn tags(&self) -> Vec<(&str, String)> { ... }
    fn extras(&self) -> Vec<(&str, String)> { ... }
}
Expand description

Interface for reporting our Error types to Sentry or as metrics

Provided Methods§

source

fn reportable_source(&self) -> Option<&(dyn ReportableError + 'static)>

Like [Error::source] but returns the source (if any) of this error as a ReportableError if it implements the trait. Otherwise callers of this method will likely subsequently call [Error::source] to return the source (if any) as the parent [Error] trait.

source

fn backtrace(&self) -> Option<&Backtrace>

Return a Backtrace for this Error if one was captured

source

fn is_sentry_event(&self) -> bool

Whether this error is reported to Sentry

source

fn metric_label(&self) -> Option<&'static str>

Errors that don’t emit Sentry events (!is_sentry_event()) emit an increment metric instead with this label

source

fn tags(&self) -> Vec<(&str, String)>

Experimental: return tag key value pairs for metrics and Sentry

source

fn extras(&self) -> Vec<(&str, String)>

Experimental: return key value pairs for Sentry Event’s extra data TODO: should probably return Vec<(&str, Value)> or Vec<(String, Value)>

Implementors§