pub enum DatabaseError {
NotFound(String),
AlreadyExists(String),
ConcurrentWriteCollision,
Timeout,
ServerError(String),
WithContext {
context: OperationContext,
source: Box<DatabaseError>,
},
Identifier(IdentifierError),
Transaction(TransactionError),
}Expand description
Errors related to database operations
Variants§
NotFound(String)
AlreadyExists(String)
ConcurrentWriteCollision
Timeout
ServerError(String)
WithContext
Identifier(IdentifierError)
Transaction(TransactionError)
Implementations§
Source§impl DatabaseError
impl DatabaseError
Sourcepub fn with_context(self, context: OperationContext) -> DatabaseError
pub fn with_context(self, context: OperationContext) -> DatabaseError
Add context to this error.
This wraps the error with additional context about the operation that was being performed when the error occurred.
§Example
use evidentsource_core::domain::{DatabaseError, OperationContext};
let err = DatabaseError::NotFound("my-db".to_string());
let with_ctx = err.with_context(OperationContext::new("transact", "my-db"));
assert!(with_ctx.to_string().contains("transact"));Sourcepub fn inner(&self) -> &DatabaseError
pub fn inner(&self) -> &DatabaseError
Get the inner error, stripping any context wrappers.
Trait Implementations§
Source§impl Clone for DatabaseError
impl Clone for DatabaseError
Source§fn clone(&self) -> DatabaseError
fn clone(&self) -> DatabaseError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DatabaseError
impl Debug for DatabaseError
Source§impl Display for DatabaseError
impl Display for DatabaseError
Source§impl Error for DatabaseError
impl Error for DatabaseError
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<DatabaseError> for StateChangeError
impl From<DatabaseError> for StateChangeError
Source§fn from(source: DatabaseError) -> StateChangeError
fn from(source: DatabaseError) -> StateChangeError
Converts to this type from the input type.
Source§impl From<IdentifierError> for DatabaseError
impl From<IdentifierError> for DatabaseError
Source§fn from(source: IdentifierError) -> DatabaseError
fn from(source: IdentifierError) -> DatabaseError
Converts to this type from the input type.
Source§impl From<TransactionError> for DatabaseError
impl From<TransactionError> for DatabaseError
Source§fn from(source: TransactionError) -> DatabaseError
fn from(source: TransactionError) -> DatabaseError
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for DatabaseError
impl RefUnwindSafe for DatabaseError
impl Send for DatabaseError
impl Sync for DatabaseError
impl Unpin for DatabaseError
impl UnwindSafe for DatabaseError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request