pub struct Options { /* private fields */ }Expand description
Options of one report (Rails’ handled:, severity:, context:, source:).
Defaults: handled, Severity::Warning, no context, source application.
§Examples
use ocre::errors::{Options, Severity};
let options = Options::new().handled(false).severity(Severity::Error).context("order_id", 42).source("billing");Implementations§
Source§impl Options
impl Options
Sourcepub fn new() -> Self
pub fn new() -> Self
The defaults: handled, warning, no context, source application.
§Examples
let _ = ocre::errors::Options::new();Sourcepub fn handled(self, handled: bool) -> Self
pub fn handled(self, handled: bool) -> Self
Whether the app recovered from the error (false for errors that failed the request or job).
§Examples
let _ = ocre::errors::Options::new().handled(false);Sourcepub fn context(self, key: &str, value: impl Serialize) -> Self
pub fn context(self, key: &str, value: impl Serialize) -> Self
Adds a context entry, merged over the request’s Reporter::set_context entries.
A value that does not serialize is null.
§Examples
let _ = ocre::errors::Options::new().context("user_id", 7);Sourcepub fn source(self, source: &str) -> Self
pub fn source(self, source: &str) -> Self
Where the error comes from, e.g. billing (Rails’ source:).
§Examples
let _ = ocre::errors::Options::new().source("webhooks");Sourcepub fn except(self, subscriber: &'static str) -> Self
pub fn except(self, subscriber: &'static str) -> Self
Does not send this report to the subscriber named name (Rails’ Rails.error.disable).
For errors a subscriber should not see, such as the failure of its own service. The report is still logged.
§Examples
let _ = ocre::errors::Options::new().except("sentry");Trait Implementations§
Auto Trait Implementations§
impl Freeze for Options
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnsafeUnpin for Options
impl UnwindSafe for Options
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more