1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
//! Errors that may occur when working with Identity Accounts.
/// Alias for a `Result` with the error type [`Error`].
pub type Result<T, E = Error> = ::core::result::Result<T, E>;
/// This type represents all possible errors that can occur in the library.
#[derive(Debug, thiserror::Error, strum::IntoStaticStr)]
pub enum Error {
/// Caused by errors from the [identity_core] crate.
#[error(transparent)]
CoreError(#[from] identity_core::Error),
/// Caused by errors from the [identity_did] crate.
#[error(transparent)]
DIDError(#[from] identity_did::Error),
/// Caused by errors from the [identity_credential] crate.
#[error(transparent)]
CredentialError(#[from] identity_credential::Error),
/// Caused by errors from the [identity_account_storage] crate.
#[error(transparent)]
AccountCoreError(#[from] identity_account_storage::Error),
/// Caused by errors from the [identity_iota_client] crate.
#[error(transparent)]
IotaClientError(#[from] identity_iota_client::Error),
/// Caused by errors from the [identity_iota_core] crate.
#[error(transparent)]
IotaCoreError(#[from] identity_iota_core::Error),
/// Caused by attempting to find an identity that does not exist.
#[error("Identity not found")]
IdentityNotFound,
/// Caused by attempting to perform an upate in an invalid context.
#[error("Update Error: {0}")]
UpdateError(#[from] crate::updates::UpdateError),
/// Caused by verification methods without fragments.
#[error("method missing fragment")]
MethodMissingFragment,
}
impl From<identity_did::did::DIDError> for Error {
fn from(error: identity_did::did::DIDError) -> Self {
identity_did::Error::from(error).into()
}
}