pub struct Oof { /* private fields */ }Expand description
Error type for oofs.
Oof implements std::error::Error.
Implementations
sourceimpl Oof
impl Oof
sourcepub fn custom(message: String) -> Oof
pub fn custom(message: String) -> Oof
Create a new Oof with custom context message.
You can also use oof!(…).
sourcepub fn tagged<T: 'static>(&self) -> bool
pub fn tagged<T: 'static>(&self) -> bool
Check if this Oof is tagged as given type.
This method only checks one level deep. To check all nested errors, use Oof::tagged_nested.
sourcepub fn tagged_nested<T: 'static>(&self) -> bool
pub fn tagged_nested<T: 'static>(&self) -> bool
Check if this Oof is tagged in all nested errors.
This method checks all levels.
sourcepub fn tagged_nested_rev<T: 'static>(&self) -> bool
pub fn tagged_nested_rev<T: 'static>(&self) -> bool
Check if this Oof is tagged in all nested errors in reverse order.
This method checks all levels.
sourcepub fn tag_if<Tag, F>(self, f: F) -> Selfwhere
Tag: 'static,
F: FnOnce(&Box<dyn Send + Sync + Error + 'static>) -> bool,
pub fn tag_if<Tag, F>(self, f: F) -> Selfwhere
Tag: 'static,
F: FnOnce(&Box<dyn Send + Sync + Error + 'static>) -> bool,
Tag Oof if given closure returns true and return Self.
sourcepub fn attach<D: Debug>(self, debuggable: D) -> Self
pub fn attach<D: Debug>(self, debuggable: D) -> Self
Attach any value that implements std::fmt::Debug.
This attached value will be listed as attachments in the displayed error.
Ex)
use oofs::{oof, oofs};
let x = 123u8;
return oof!("custom error")
.attach(x)
.attach("some attachment")
.into_res();Above example will output:
custom error at `oofs/tests/basic.rs:9:13`
Attachments:
0: 123
1: "some attachment"sourcepub fn attach_lazy<D: ToString, F: FnOnce() -> D>(self, f: F) -> Self
pub fn attach_lazy<D: ToString, F: FnOnce() -> D>(self, f: F) -> Self
Lazily load and attach any value that implements ToString.
This attached value will be listed as attachments in the displayed error.
Ex)
use oofs::{oof, oofs};
return oof!("custom error")
.attach_lazy(|| "some attachment")
.into_res();Above example will output:
custom error at `oofs/tests/basic.rs:9:13`
Attachments:
0: "some attachment"