pub enum StorageError {
Show 15 variants
ResourceNotFound {
tenant_id: String,
resource_type: String,
id: String,
},
ResourceAlreadyExists {
tenant_id: String,
resource_type: String,
id: String,
},
InvalidData {
message: String,
cause: Option<String>,
},
TenantNotFound {
tenant_id: String,
},
InvalidQuery {
message: String,
attribute: Option<String>,
value: Option<String>,
},
CapacityExceeded {
message: String,
current_count: Option<usize>,
limit: Option<usize>,
},
ConcurrentModification {
tenant_id: String,
resource_type: String,
id: String,
expected_version: Option<String>,
actual_version: Option<String>,
},
Unavailable {
message: String,
retry_after: Option<Duration>,
},
PermissionDenied {
operation: String,
resource: String,
},
Timeout {
operation: String,
duration: Duration,
},
DataCorruption {
tenant_id: String,
resource_type: String,
id: Option<String>,
details: String,
},
Configuration {
message: String,
parameter: Option<String>,
},
Network {
message: String,
endpoint: Option<String>,
},
Serialization {
message: String,
data_type: Option<String>,
},
Internal {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
}
Expand description
Errors that can occur during storage operations.
These errors represent failures in the storage layer and are protocol-agnostic. They focus on data persistence, retrieval, and basic storage operations without any knowledge of SCIM semantics or business rules.
Variants§
ResourceNotFound
The requested resource was not found.
ResourceAlreadyExists
The resource already exists when it shouldn’t (for operations requiring uniqueness).
InvalidData
Invalid data format or structure that cannot be stored.
TenantNotFound
The tenant was not found or is invalid.
InvalidQuery
Invalid query parameters or search criteria.
CapacityExceeded
Storage capacity exceeded (disk full, memory limit, etc.).
ConcurrentModification
Concurrent modification detected (optimistic locking failure).
Fields
Storage backend is temporarily unavailable.
PermissionDenied
Permission denied for the storage operation.
Timeout
Timeout occurred during storage operation.
DataCorruption
Corruption detected in stored data.
Configuration
Configuration error in the storage backend.
Network
Network-related error for distributed storage systems.
Serialization
Serialization or deserialization error.
Internal
Generic internal storage error.
Implementations§
Source§impl StorageError
impl StorageError
Sourcepub fn resource_not_found(
tenant_id: impl Into<String>,
resource_type: impl Into<String>,
id: impl Into<String>,
) -> Self
pub fn resource_not_found( tenant_id: impl Into<String>, resource_type: impl Into<String>, id: impl Into<String>, ) -> Self
Create a new ResourceNotFound error.
Sourcepub fn resource_already_exists(
tenant_id: impl Into<String>,
resource_type: impl Into<String>,
id: impl Into<String>,
) -> Self
pub fn resource_already_exists( tenant_id: impl Into<String>, resource_type: impl Into<String>, id: impl Into<String>, ) -> Self
Create a new ResourceAlreadyExists error.
Sourcepub fn invalid_data(message: impl Into<String>) -> Self
pub fn invalid_data(message: impl Into<String>) -> Self
Create a new InvalidData error.
Sourcepub fn invalid_data_with_cause(
message: impl Into<String>,
cause: impl Into<String>,
) -> Self
pub fn invalid_data_with_cause( message: impl Into<String>, cause: impl Into<String>, ) -> Self
Create a new InvalidData error with a cause.
Sourcepub fn tenant_not_found(tenant_id: impl Into<String>) -> Self
pub fn tenant_not_found(tenant_id: impl Into<String>) -> Self
Create a new TenantNotFound error.
Sourcepub fn invalid_query(message: impl Into<String>) -> Self
pub fn invalid_query(message: impl Into<String>) -> Self
Create a new InvalidQuery error.
Sourcepub fn capacity_exceeded(message: impl Into<String>) -> Self
pub fn capacity_exceeded(message: impl Into<String>) -> Self
Create a new CapacityExceeded error.
Sourcepub fn concurrent_modification(
tenant_id: impl Into<String>,
resource_type: impl Into<String>,
id: impl Into<String>,
) -> Self
pub fn concurrent_modification( tenant_id: impl Into<String>, resource_type: impl Into<String>, id: impl Into<String>, ) -> Self
Create a new ConcurrentModification error.
Create a new Unavailable error.
Sourcepub fn permission_denied(
operation: impl Into<String>,
resource: impl Into<String>,
) -> Self
pub fn permission_denied( operation: impl Into<String>, resource: impl Into<String>, ) -> Self
Create a new PermissionDenied error.
Sourcepub fn timeout(operation: impl Into<String>, duration: Duration) -> Self
pub fn timeout(operation: impl Into<String>, duration: Duration) -> Self
Create a new Timeout error.
Sourcepub fn data_corruption(
tenant_id: impl Into<String>,
resource_type: impl Into<String>,
details: impl Into<String>,
) -> Self
pub fn data_corruption( tenant_id: impl Into<String>, resource_type: impl Into<String>, details: impl Into<String>, ) -> Self
Create a new DataCorruption error.
Sourcepub fn configuration(message: impl Into<String>) -> Self
pub fn configuration(message: impl Into<String>) -> Self
Create a new Configuration error.
Sourcepub fn serialization(message: impl Into<String>) -> Self
pub fn serialization(message: impl Into<String>) -> Self
Create a new Serialization error.
Sourcepub fn internal_with_source(
message: impl Into<String>,
source: Box<dyn Error + Send + Sync>,
) -> Self
pub fn internal_with_source( message: impl Into<String>, source: Box<dyn Error + Send + Sync>, ) -> Self
Create a new Internal error with a source error.
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Check if this error indicates a resource was not found.
Sourcepub fn is_conflict(&self) -> bool
pub fn is_conflict(&self) -> bool
Check if this error indicates a conflict (resource already exists or concurrent modification).
Sourcepub fn is_temporary(&self) -> bool
pub fn is_temporary(&self) -> bool
Check if this error indicates a temporary failure that might succeed on retry.
Sourcepub fn is_invalid_input(&self) -> bool
pub fn is_invalid_input(&self) -> bool
Check if this error indicates invalid input data.
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
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