pub enum StorageError {
Database(Error),
Serialization(Error),
NotFound {
resource_type: ResourceType,
resource_id: ResourceId,
},
NotFoundLegacy(String),
ConstraintViolation(String),
ConcurrentModification(String),
Migration(String),
EncryptionError(String),
ValidationError(String),
BackupError(String),
BatchTooLarge {
size: usize,
max: usize,
},
}Expand description
Errors that can occur during storage operations
Variants§
Database(Error)
Database error
Serialization(Error)
Serialization error
NotFound
Not found error with detailed context
NotFoundLegacy(String)
Legacy not found error (for backwards compatibility)
ConstraintViolation(String)
Constraint violation
ConcurrentModification(String)
Concurrent modification detected (optimistic locking)
Migration(String)
Migration error
EncryptionError(String)
Encryption error
ValidationError(String)
Validation error
BackupError(String)
Backup/restore error
BatchTooLarge
Batch operation error
Implementations§
Source§impl StorageError
impl StorageError
Sourcepub fn not_found<T: Into<ResourceId>>(
resource_type: ResourceType,
resource_id: T,
) -> Self
pub fn not_found<T: Into<ResourceId>>( resource_type: ResourceType, resource_id: T, ) -> Self
Create a not found error with resource type and ID
Sourcepub fn constraint_violation<S: Into<String>>(message: S) -> Self
pub fn constraint_violation<S: Into<String>>(message: S) -> Self
Create a constraint violation error
Sourcepub fn validation<S: Into<String>>(message: S) -> Self
pub fn validation<S: Into<String>>(message: S) -> Self
Create a validation error
Sourcepub fn encryption<S: Into<String>>(message: S) -> Self
pub fn encryption<S: Into<String>>(message: S) -> Self
Create an encryption error
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Check if this is a not found error
Sourcepub fn is_constraint_violation(&self) -> bool
pub fn is_constraint_violation(&self) -> bool
Check if this is a constraint violation error
Sourcepub fn is_validation_error(&self) -> bool
pub fn is_validation_error(&self) -> bool
Check if this is a validation error
Sourcepub fn is_database_error(&self) -> bool
pub fn is_database_error(&self) -> bool
Check if this is a database error
Sourcepub fn resource_type(&self) -> Option<&ResourceType>
pub fn resource_type(&self) -> Option<&ResourceType>
Get the resource type if this is a not found error
Sourcepub fn resource_id(&self) -> Option<&ResourceId>
pub fn resource_id(&self) -> Option<&ResourceId>
Get the resource ID if this is a not found error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if the error is retryable (transient database errors)
Trait Implementations§
Source§impl Debug for StorageError
impl Debug for StorageError
Source§impl Display for StorageError
impl Display for StorageError
Source§impl Error for StorageError
impl Error for StorageError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<Error> for StorageError
impl From<Error> for StorageError
Auto Trait Implementations§
impl Freeze for StorageError
impl !RefUnwindSafe for StorageError
impl Send for StorageError
impl Sync for StorageError
impl Unpin for StorageError
impl !UnwindSafe for StorageError
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more