Struct ockam_core::Error
source · pub struct Error(_);
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) -> Selfwhere
E: Into<Box<dyn Error + Send + Sync>>,
pub fn new<E>(origin: Origin, kind: Kind, cause: E) -> Selfwhere E: Into<Box<dyn Error + Send + Sync>>,
Construct a new error given ErrorCodes and a cause.
sourcepub fn new_unknown<E>(origin: Origin, cause: E) -> Selfwhere
E: Into<Box<dyn Error + Send + Sync>>,
pub fn new_unknown<E>(origin: Origin, cause: E) -> Selfwhere E: Into<Box<dyn Error + Send + Sync>>,
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) -> Self
pub fn new_without_cause(origin: Origin, kind: Kind) -> Self
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::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 ErrorTrait + 'static)>
fn source(&self) -> Option<&(dyn ErrorTrait + '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<RouteError> for Error
impl From<RouteError> for Error
source§fn from(err: RouteError) -> Self
fn from(err: RouteError) -> Self
Converts to this type from the input type.