pub enum Error {
Crypto(CryptoError),
Did(DidError),
Credential(CredentialError),
Serialization(SerializationError),
Store(StoreError),
Protocol(ProtocolError),
WithContext {
source: Box<Error>,
context: String,
},
}Expand description
Top-level error type for all BaseID operations.
Variants§
Crypto(CryptoError)
Did(DidError)
Credential(CredentialError)
Serialization(SerializationError)
Store(StoreError)
Protocol(ProtocolError)
WithContext
Implementations§
Source§impl Error
impl Error
Sourcepub fn with_context(self, context: impl Into<String>) -> Self
pub fn with_context(self, context: impl Into<String>) -> Self
Attach additional context to this error.
Wraps the error with a human-readable message that appears before the original error in display output.
§Example
use baseid_core::error::{Error, DidError};
let err: Error = DidError::ResolutionFailed.into();
let err = err.with_context("did:web:example.com");
assert!(format!("{err}").contains("did:web:example.com"));Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns 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<CredentialError> for Error
impl From<CredentialError> for Error
Source§fn from(source: CredentialError) -> Self
fn from(source: CredentialError) -> Self
Converts to this type from the input type.
Source§impl From<CryptoError> for Error
impl From<CryptoError> for Error
Source§fn from(source: CryptoError) -> Self
fn from(source: CryptoError) -> Self
Converts to this type from the input type.
Source§impl From<ProtocolError> for Error
impl From<ProtocolError> for Error
Source§fn from(source: ProtocolError) -> Self
fn from(source: ProtocolError) -> Self
Converts to this type from the input type.
Source§impl From<SerializationError> for Error
impl From<SerializationError> for Error
Source§fn from(source: SerializationError) -> Self
fn from(source: SerializationError) -> Self
Converts to this type from the input type.
Source§impl From<StoreError> for Error
impl From<StoreError> for Error
Source§fn from(source: StoreError) -> Self
fn from(source: StoreError) -> Self
Converts to this type from the input type.
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