pub struct Error(/* private fields */);
Expand description
An error.
An Error
holds a chain of ProtoBasedErrorCode
.
Implementations§
Trait Implementations§
source§impl Error for Error
impl Error for Error
Implements std::error::Error
for Error
.
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
source§impl<'s, ErrorEnum: AllowedProtoBasedErrorCodeEnum, S> From<(ErrorEnum, &'s S)> for Errorwhere
S: AsRef<str> + 's,
ErrorCode: From<(ErrorEnum, &'s S)>,
impl<'s, ErrorEnum: AllowedProtoBasedErrorCodeEnum, S> From<(ErrorEnum, &'s S)> for Errorwhere S: AsRef<str> + 's, ErrorCode: From<(ErrorEnum, &'s S)>,
Instantiates an Error
from an enum value and a string.
source§impl<'s, ErrorEnum: AllowedProtoBasedErrorCodeEnum> From<(ErrorEnum, &'s str)> for Errorwhere
ErrorCode: From<(ErrorEnum, &'s str)>,
impl<'s, ErrorEnum: AllowedProtoBasedErrorCodeEnum> From<(ErrorEnum, &'s str)> for Errorwhere ErrorCode: From<(ErrorEnum, &'s str)>,
Instantiates an Error
from an enum value and a string.
source§impl<ErrorEnum: AllowedProtoBasedErrorCodeEnum> From<(ErrorEnum, String)> for Errorwhere
ErrorCode: From<(ErrorEnum, String)>,
impl<ErrorEnum: AllowedProtoBasedErrorCodeEnum> From<(ErrorEnum, String)> for Errorwhere ErrorCode: From<(ErrorEnum, String)>,
Instantiates an Error
from an enum value and a string.
source§impl<S> From<(ProtoBasedErrorCode, &S)> for Errorwhere
S: AsRef<str>,
impl<S> From<(ProtoBasedErrorCode, &S)> for Errorwhere S: AsRef<str>,
Instantiates an Error
from an enum value and a string.
source§fn from((e, s): (ProtoBasedErrorCode, &S)) -> Self
fn from((e, s): (ProtoBasedErrorCode, &S)) -> Self
source§impl From<(ProtoBasedErrorCode, &str)> for Error
impl From<(ProtoBasedErrorCode, &str)> for Error
Instantiates an Error
from an enum value and a string.
source§fn from((e, s): (ProtoBasedErrorCode, &str)) -> Self
fn from((e, s): (ProtoBasedErrorCode, &str)) -> Self
source§impl From<(ProtoBasedErrorCode, String)> for Error
impl From<(ProtoBasedErrorCode, String)> for Error
Instantiates an Error
from an enum value and a string.
source§fn from((e, s): (ProtoBasedErrorCode, String)) -> Self
fn from((e, s): (ProtoBasedErrorCode, String)) -> Self
source§impl<ErrorEnum: AllowedProtoBasedErrorCodeEnum> From<ErrorEnum> for Errorwhere
ErrorCode: From<ErrorEnum>,
impl<ErrorEnum: AllowedProtoBasedErrorCodeEnum> From<ErrorEnum> for Errorwhere ErrorCode: From<ErrorEnum>,
Instantiates an Error
from an enum value.
source§impl From<ProtoBasedErrorCode> for Error
impl From<ProtoBasedErrorCode> for Error
Instantiates an Error
from an ProtoBasedErrorCode
.
source§fn from(e: ProtoBasedErrorCode) -> Self
fn from(e: ProtoBasedErrorCode) -> Self
source§impl<'s, ErrorEnum: AllowedProtoBasedErrorCodeEnum, S> Shr<(ErrorEnum, &'s S)> for Errorwhere
ErrorCode: From<(ErrorEnum, &'s S)>,
S: AsRef<str> + 's,
impl<'s, ErrorEnum: AllowedProtoBasedErrorCodeEnum, S> Shr<(ErrorEnum, &'s S)> for Errorwhere ErrorCode: From<(ErrorEnum, &'s S)>, S: AsRef<str> + 's,
Appends an Error
into the chain, using the >>
operator and a string.
source§impl<'s, ErrorEnum: AllowedProtoBasedErrorCodeEnum> Shr<(ErrorEnum, &'s str)> for Errorwhere
ErrorCode: From<(ErrorEnum, &'s str)>,
impl<'s, ErrorEnum: AllowedProtoBasedErrorCodeEnum> Shr<(ErrorEnum, &'s str)> for Errorwhere ErrorCode: From<(ErrorEnum, &'s str)>,
Appends an Error
into the chain, using the >>
operator and a string.
source§impl<ErrorEnum: AllowedProtoBasedErrorCodeEnum> Shr<(ErrorEnum, String)> for Errorwhere
ErrorCode: From<(ErrorEnum, String)>,
impl<ErrorEnum: AllowedProtoBasedErrorCodeEnum> Shr<(ErrorEnum, String)> for Errorwhere ErrorCode: From<(ErrorEnum, String)>,
Appends an Error
into the chain, using the >>
operator and a string.
source§impl<S> Shr<(ProtoBasedErrorCode, &S)> for Errorwhere
S: AsRef<str>,
impl<S> Shr<(ProtoBasedErrorCode, &S)> for Errorwhere S: AsRef<str>,
Appends an Error
into the chain, using the >>
operator and a string.
source§impl Shr<(ProtoBasedErrorCode, &str)> for Error
impl Shr<(ProtoBasedErrorCode, &str)> for Error
Appends an Error
into the chain, using the >>
operator and a string.
source§impl Shr<(ProtoBasedErrorCode, String)> for Error
impl Shr<(ProtoBasedErrorCode, String)> for Error
Appends an Error
into the chain, using the >>
operator.
source§impl<ErrorEnum: AllowedProtoBasedErrorCodeEnum> Shr<ErrorEnum> for Errorwhere
ErrorCode: From<ErrorEnum>,
impl<ErrorEnum: AllowedProtoBasedErrorCodeEnum> Shr<ErrorEnum> for Errorwhere ErrorCode: From<ErrorEnum>,
Appends an Error
into the chain, using the >>
operator.
The >>
operator is used to easily build a chain of error:
child_error -> parent_error
, where child_error
is more precise than
parent_error
.
Example
// Creates a new Error.
let e = Error::from(pb::ASN1Error::ASN1ERROR_INVALID_FORMAT);
// Creates a new Error, "invalid certificate", and appends the previous one.
let e = e >> pb::CertificateError::CERTIFICATEERROR_MALFORMED;
// Now, the error chain is the following:
// CertificateError::CERTIFICATEERROR_MALFORMED -> ASN1Error>>ASN1ERROR_INVALID_FORMAT
// It is read as "a certificate error occurred: malformed certificate,
// because: an ASN.1 error occurred: invalid format".