use thiserror::Error;
#[derive(Error, Debug)]
pub enum OperationBuilderError {
#[error(transparent)]
ValidateOperationError(#[from] ValidateOperationError),
}
#[derive(Error, Debug)]
pub enum EncodeOperationError {
#[error("cbor encoder failed {0}")]
EncoderIOFailed(String),
#[error("cbor encoder failed serializing value {0}")]
EncoderFailed(String),
}
#[derive(Error, Debug)]
pub enum DecodeOperationError {
#[error("cbor decoder failed {0}")]
DecoderIOFailed(String),
#[error("invalid cbor encoding at byte {0}")]
InvalidCBOREncoding(usize),
#[error("{0}")]
InvalidEncoding(String),
#[error("cbor decoder exceeded recursion limit")]
RecursionLimitExceeded,
}
#[derive(Error, Debug)]
pub enum ValidateOperationError {
#[error("operation schema id not matching with given schema: {0}, expected: {1}")]
SchemaNotMatching(String, String),
#[error("expected 'fields' in CREATE or UPDATE operation")]
ExpectedFields,
#[error("unexpected 'fields' in DELETE operation")]
UnexpectedFields,
#[error("expected 'previous_operations' in UPDATE or DELETE operation")]
ExpectedPreviousOperations,
#[error("unexpected 'previous_operations' in CREATE operation")]
UnexpectedPreviousOperations,
#[error(transparent)]
SchemaValidation(#[from] crate::schema::validate::error::ValidationError),
}
#[derive(Error, Debug)]
pub enum FieldsError {
#[error("field '{0}' already exists")]
FieldDuplicate(String),
#[error("field does not exist")]
UnknownField,
}
#[derive(Error, Debug)]
pub enum VerifiedOperationError {
#[error(transparent)]
ValidateOperationError(#[from] ValidateOperationError),
#[error(transparent)]
ValidateEntryError(#[from] crate::entry::error::ValidateEntryError),
}
#[derive(Error, Debug)]
pub enum OperationIdError {
#[error(transparent)]
HashError(#[from] crate::hash::error::HashError),
}
#[derive(Error, Debug)]
pub enum RelationError {
#[error(transparent)]
DocumentIdError(#[from] crate::document::error::DocumentIdError),
}
#[derive(Error, Debug)]
pub enum PinnedRelationError {
#[error(transparent)]
DocumentViewIdError(#[from] crate::document::error::DocumentViewIdError),
}
#[derive(Error, Debug)]
pub enum RelationListError {
#[error(transparent)]
DocumentIdError(#[from] crate::document::error::DocumentIdError),
}
#[derive(Error, Debug)]
pub enum PinnedRelationListError {
#[error(transparent)]
DocumentViewIdError(#[from] crate::document::error::DocumentViewIdError),
}
#[derive(Error, Debug)]
#[allow(missing_copy_implementations)]
pub enum OperationActionError {
#[error("unknown operation action {0}")]
UnknownAction(u64),
}