pub struct Error(/* private fields */);
Expand description
The type of errors returned by Ockam functions.
Errors store:
- An
ErrorCode
, which abstractly describe the problem and allow easily matching against specific categories of error. - An open-ended payload, to which arbitrary data can be attached.
- The “cause”, of this error, if it has not been lost to serialization.
- Various debugging information, such as a backtrace and spantrace (which is lost over serialization).
Implementations§
source§impl Error
impl Error
sourcepub fn new<E>(origin: Origin, kind: Kind, cause: E) -> Error
pub fn new<E>(origin: Origin, kind: Kind, cause: E) -> Error
Construct a new error given ErrorCodes and a cause.
sourcepub fn new_unknown<E>(origin: Origin, cause: E) -> Error
pub fn new_unknown<E>(origin: Origin, cause: E) -> Error
Construct a new error with “unknown” error codes.
This ideally should not be used inside Ockam.
sourcepub fn new_without_cause(origin: Origin, kind: Kind) -> Error
pub fn new_without_cause(origin: Origin, kind: Kind) -> Error
Construct a new error without an apparent cause
This constructor should be used for any error occurring because of a None unwrap.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Error
impl<'de> Deserialize<'de> for Error
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Error, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Error, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Error for Error
impl Error for Error
source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl From<IdentityError> for Error
impl From<IdentityError> for Error
source§fn from(err: IdentityError) -> Error
fn from(err: IdentityError) -> Error
Converts to this type from the input type.
source§impl From<OckamError> for Error
impl From<OckamError> for Error
source§fn from(err: OckamError) -> Error
fn from(err: OckamError) -> Error
Converts to this type from the input type.
source§impl From<ParseError> for Error
impl From<ParseError> for Error
source§fn from(e: ParseError) -> Error
fn from(e: ParseError) -> Error
Converts to this type from the input type.
source§impl From<ParseError> for Error
impl From<ParseError> for Error
source§fn from(e: ParseError) -> Error
fn from(e: ParseError) -> Error
Converts to this type from the input type.
source§impl From<RouteError> for Error
impl From<RouteError> for Error
source§fn from(err: RouteError) -> Error
fn from(err: RouteError) -> Error
Converts to this type from the input type.
source§impl From<TransportError> for Error
impl From<TransportError> for Error
source§fn from(err: TransportError) -> Error
fn from(err: TransportError) -> Error
Converts to this type from the input type.
source§impl From<VaultError> for Error
impl From<VaultError> for Error
source§fn from(err: VaultError) -> Error
fn from(err: VaultError) -> Error
Converts to this type from the input type.
source§impl Serialize for Error
impl Serialize for Error
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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
Mutably borrows from an owned value. Read more
source§impl<T> Decodable for Twhere
T: DeserializeOwned,
impl<T> Decodable for Twhere
T: DeserializeOwned,
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<E> InstrumentError for Ewhere
TracedError<E>: From<E>,
impl<E> InstrumentError for Ewhere
TracedError<E>: From<E>,
§type Instrumented = TracedError<E>
type Instrumented = TracedError<E>
The type of the wrapped error after instrumentation
source§fn in_current_span(self) -> <E as InstrumentError>::Instrumented
fn in_current_span(self) -> <E as InstrumentError>::Instrumented
Instrument an Error by bundling it with a SpanTrace Read more
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> ⓘ
Converts
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> ⓘ
Converts
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