use super::{
ipc::IpcError,
nrs::NrsMap,
safeurl::{Error as UrlError, SafeUrl, XorUrl},
};
use bls::Error as BlsError;
use sn_client::Error as ClientError;
use sn_dbc::Error as DbcError;
use sn_interface::types::Error as InterfaceError;
use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Error)]
#[allow(clippy::large_enum_variant)]
#[non_exhaustive]
pub enum Error {
#[error("AuthError: {0}")]
AuthError(String),
#[error("AuthIpcError: {0}")]
AuthIpcError(#[from] IpcError),
#[error("AuthdClientError: {0}")]
AuthdClientError(String),
#[error("AuthdError: {0}")]
AuthdError(String),
#[error("AuthdAlreadyStarted: {0}")]
AuthdAlreadyStarted(String),
#[error("AuthenticatorError: {0}")]
AuthenticatorError(String),
#[error("ConflictingNrsEntries: {0}")]
ConflictingNrsEntries(String, Vec<(String, SafeUrl)>, NrsMap),
#[error("ConnectionError: {0}")]
ConnectionError(String),
#[error("NetDataError: {0}")]
NetDataError(String),
#[error("ContentNotFound: {0}")]
ContentNotFound(String),
#[error("ContentError: {0}")]
ContentError(String),
#[error("ClientError: {0}")]
ClientError(#[from] ClientError),
#[error("EmptyContent: {0}")]
EmptyContent(String),
#[error("AccessDenied: {0}")]
AccessDenied(String),
#[error("VersionNotFound: {0}")]
VersionNotFound(String),
#[cfg(feature = "app")]
#[error("No entry with hash {0:?}")]
HashNotFound(crate::register::EntryHash),
#[error("EntryNotFound: {0}")]
EntryNotFound(String),
#[error("File named \"{0}\" already exists on target with same link.")]
FileAlreadyExists(String),
#[error("File named \"{0}\" already exists on target. Use the 'force' flag to replace it.")]
FileNameConflict(String),
#[error("InvalidAmount: {0}")]
InvalidAmount(String),
#[error("InvalidUtf8Sequence: {0}")]
InvalidUtf8Sequence(#[from] std::str::Utf8Error),
#[error("InvalidXorUrl: {0}")]
InvalidXorUrl(String),
#[error("InvalidInput: {0}")]
InvalidInput(String),
#[error("InvalidMediaType: {0}")]
InvalidMediaType(String),
#[error("Not enough balance: {0}")]
NotEnoughBalance(String),
#[error("NrsNameAlreadyExists: {0}")]
NrsNameAlreadyExists(String),
#[error("Serialisation: {0}")]
Serialisation(String),
#[error("FileSystemError: {0}")]
FileSystemError(String),
#[error("UrlError: {0}")]
UrlError(#[from] UrlError),
#[error("DbcError: {0}")]
DbcError(#[from] DbcError),
#[error("InterfaceError: {0}")]
InterfaceError(#[from] InterfaceError),
#[error("IoError: {0}")]
IoError(#[from] std::io::Error),
#[error("UnversionedContentError: {0}")]
UnversionedContentError(String),
#[error("Content may have been correctly stored on the network, but verification failed: {0}")]
ContentUploadVerificationFailed(XorUrl),
#[error("DbcReissueError: {0}")]
DbcReissueError(String),
#[error("DBC validity verification failed: {0}")]
DbcVerificationFailed(String),
#[error("DbcDepositError: {0}")]
DbcDepositError(String),
#[error("The secret key does not match the public key for this owned DBC")]
DbcDepositInvalidSecretKey,
#[error("NotImplementedError: {0}")]
NotImplementedError(String),
#[error("BlsError: {0}")]
BlsError(#[from] BlsError),
}