pub struct Error(/* private fields */);
Expand description
Just use this type as return error type for your handler functions (ex: Result<String, custom_derive::Error>
)
and after running the usual let _guard = sentry::init(...);
and it will send any error to sentry.
Note that you should use the failure
crate to propagate your errors if you wish to have proper backtrace handling.
Also, using sentry_rocket::sentry
instead of sentry
will ensure the versions match so that everything works properly
(also, then you don’t need sentry
as a dependency for your project, only sentry_rocket
)
Methods from Deref<Target = Error>§
Sourcepub fn as_fail(&self) -> &(dyn Fail + 'static)
pub fn as_fail(&self) -> &(dyn Fail + 'static)
Return a reference to the underlying failure that this Error
contains.
Sourcepub fn cause(&self) -> &(dyn Fail + 'static)
👎Deprecated since 0.1.2: please use ‘as_fail()’ method instead
pub fn cause(&self) -> &(dyn Fail + 'static)
Returns a reference to the underlying cause of this Error
. Unlike the
method on Fail
, this does not return an Option
. The Error
type
always has an underlying failure.
This method has been deprecated in favor of the Error::as_fail method, which does the same thing.
Sourcepub fn backtrace(&self) -> &Backtrace
pub fn backtrace(&self) -> &Backtrace
Gets a reference to the Backtrace
for this Error
.
If the failure this wrapped carried a backtrace, that backtrace will
be returned. Otherwise, the backtrace will have been constructed at
the point that failure was cast into the Error
type.
Sourcepub fn find_root_cause(&self) -> &(dyn Fail + 'static)
pub fn find_root_cause(&self) -> &(dyn Fail + 'static)
Returns the “root cause” of this error - the last value in the
cause chain which does not return an underlying cause
.
Sourcepub fn iter_causes(&self) -> Causes<'_>
pub fn iter_causes(&self) -> Causes<'_>
Returns a iterator over the causes of this error with the cause
of the fail as the first item and the root_cause
as the final item.
Use iter_chain
to also include the fail of this error itself.
Sourcepub fn iter_chain(&self) -> Causes<'_>
pub fn iter_chain(&self) -> Causes<'_>
Returns a iterator over all fails up the chain from the current
as the first item up to the root_cause
as the final item.
This means that the chain also includes the fail itself which
means that it does not start with cause
. To skip the outermost
fail use iter_causes
instead.
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: Fail,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: Fail,
Attempts to downcast this Error
to a particular Fail
type by
reference.
If the underlying error is not of type T
, this will return None
.
Sourcepub fn root_cause(&self) -> &(dyn Fail + 'static)
👎Deprecated since 0.1.2: please use the ‘find_root_cause()’ method instead
pub fn root_cause(&self) -> &(dyn Fail + 'static)
Deprecated alias to find_root_cause
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
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
Source§impl<T> IntoCollection<T> for T
impl<T> IntoCollection<T> for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more