use crate::document::error::DocumentBuilderError;
use crate::document::{DocumentId, DocumentViewId};
use crate::entry::error::{LogIdError, SeqNumError, ValidateEntryError};
use crate::hash::error::HashError;
use crate::hash::Hash;
use crate::identity::error::PublicKeyError;
use crate::operation::error::ValidateOperationError;
use crate::operation::OperationId;
#[derive(thiserror::Error, Debug)]
pub enum ValidationError {
#[error(transparent)]
AuthorValidation(#[from] PublicKeyError),
#[error(transparent)]
HashValidation(#[from] HashError),
#[error(transparent)]
EntryValidation(#[from] ValidateEntryError),
#[error(transparent)]
OperationValidation(#[from] ValidateOperationError),
#[error(transparent)]
LogIdValidation(#[from] LogIdError),
#[error(transparent)]
SeqNumValidation(#[from] SeqNumError),
#[error(transparent)]
BambooValidation(#[from] bamboo_rs_core_ed25519_yasmf::verify::Error),
}
#[derive(thiserror::Error, Debug)]
pub enum LogStorageError {
#[error("Error occured during `LogStorage` request in storage provider: {0}")]
Custom(String),
}
#[derive(thiserror::Error, Debug)]
pub enum EntryStorageError {
#[error("Error occured during `EntryStorage` request in storage provider: {0}")]
Custom(String),
#[error("Could not find expected backlink in database for entry with id: {0}")]
ExpectedBacklinkMissing(Hash),
#[error(
"The backlink hash encoded in the entry: {0} did not match the expected backlink hash"
)]
InvalidBacklinkPassed(Hash),
#[error("Could not find expected skiplink in database for entry with id: {0}")]
ExpectedSkiplinkMissing(Hash),
#[error("The skiplink hash encoded in the entry: {0} did not match the known hash of the skiplink target")]
InvalidSkiplinkPassed(Hash),
#[error("Could not find expected skiplink entry in database")]
ExpectedNextSkiplinkMissing,
#[error("Entry required for requested certificate pool missing at seq num: {0}")]
CertPoolEntryMissing(u64),
#[error(transparent)]
ValidationError(#[from] ValidationError),
}
#[derive(thiserror::Error, Debug)]
pub enum OperationStorageError {
#[error("Error occured in OperationStore: {0}")]
Custom(String),
#[error("A fatal error occured in OperationStore: {0}")]
FatalStorageError(String),
#[error("Error occured when inserting an operation with id {0:?} into storage")]
InsertionError(OperationId),
}
#[derive(thiserror::Error, Debug)]
pub enum DocumentStorageError {
#[error("Error occured in DocumentStore: {0}")]
Custom(String),
#[error("A fatal error occured in DocumentStore: {0}")]
FatalStorageError(String),
#[error("Error occured when inserting a document view with id {0:?} into storage")]
DocumentViewInsertionError(DocumentViewId),
#[error("Error occured when inserting a document with id {0:?} into storage")]
DocumentInsertionError(DocumentId),
#[error(transparent)]
OperationValidation(#[from] ValidateOperationError),
#[error(transparent)]
OperationStorageError(#[from] OperationStorageError),
#[error(transparent)]
DocumentBuilderError(#[from] DocumentBuilderError),
}