StorageError

Enum StorageError 

Source
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.

Fields

§tenant_id: String
§resource_type: String
§

ResourceAlreadyExists

The resource already exists when it shouldn’t (for operations requiring uniqueness).

Fields

§tenant_id: String
§resource_type: String
§

InvalidData

Invalid data format or structure that cannot be stored.

Fields

§message: String
§

TenantNotFound

The tenant was not found or is invalid.

Fields

§tenant_id: String
§

InvalidQuery

Invalid query parameters or search criteria.

Fields

§message: String
§attribute: Option<String>
§

CapacityExceeded

Storage capacity exceeded (disk full, memory limit, etc.).

Fields

§message: String
§current_count: Option<usize>
§limit: Option<usize>
§

ConcurrentModification

Concurrent modification detected (optimistic locking failure).

Fields

§tenant_id: String
§resource_type: String
§expected_version: Option<String>
§actual_version: Option<String>
§

Unavailable

Storage backend is temporarily unavailable.

Fields

§message: String
§retry_after: Option<Duration>
§

PermissionDenied

Permission denied for the storage operation.

Fields

§operation: String
§resource: String
§

Timeout

Timeout occurred during storage operation.

Fields

§operation: String
§duration: Duration
§

DataCorruption

Corruption detected in stored data.

Fields

§tenant_id: String
§resource_type: String
§details: String
§

Configuration

Configuration error in the storage backend.

Fields

§message: String
§parameter: Option<String>
§

Network

Network-related error for distributed storage systems.

Fields

§message: String
§endpoint: Option<String>
§

Serialization

Serialization or deserialization error.

Fields

§message: String
§data_type: Option<String>
§

Internal

Generic internal storage error.

Fields

§message: String
§source: Option<Box<dyn Error + Send + Sync>>

Implementations§

Source§

impl StorageError

Source

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.

Source

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.

Source

pub fn invalid_data(message: impl Into<String>) -> Self

Create a new InvalidData error.

Source

pub fn invalid_data_with_cause( message: impl Into<String>, cause: impl Into<String>, ) -> Self

Create a new InvalidData error with a cause.

Source

pub fn tenant_not_found(tenant_id: impl Into<String>) -> Self

Create a new TenantNotFound error.

Source

pub fn invalid_query(message: impl Into<String>) -> Self

Create a new InvalidQuery error.

Source

pub fn capacity_exceeded(message: impl Into<String>) -> Self

Create a new CapacityExceeded error.

Source

pub fn concurrent_modification( tenant_id: impl Into<String>, resource_type: impl Into<String>, id: impl Into<String>, ) -> Self

Create a new ConcurrentModification error.

Source

pub fn unavailable(message: impl Into<String>) -> Self

Create a new Unavailable error.

Source

pub fn permission_denied( operation: impl Into<String>, resource: impl Into<String>, ) -> Self

Create a new PermissionDenied error.

Source

pub fn timeout(operation: impl Into<String>, duration: Duration) -> Self

Create a new Timeout error.

Source

pub fn data_corruption( tenant_id: impl Into<String>, resource_type: impl Into<String>, details: impl Into<String>, ) -> Self

Create a new DataCorruption error.

Source

pub fn configuration(message: impl Into<String>) -> Self

Create a new Configuration error.

Source

pub fn network(message: impl Into<String>) -> Self

Create a new Network error.

Source

pub fn serialization(message: impl Into<String>) -> Self

Create a new Serialization error.

Source

pub fn internal(message: impl Into<String>) -> Self

Create a new Internal error.

Source

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.

Source

pub fn is_not_found(&self) -> bool

Check if this error indicates a resource was not found.

Source

pub fn is_conflict(&self) -> bool

Check if this error indicates a conflict (resource already exists or concurrent modification).

Source

pub fn is_temporary(&self) -> bool

Check if this error indicates a temporary failure that might succeed on retry.

Source

pub fn is_invalid_input(&self) -> bool

Check if this error indicates invalid input data.

Trait Implementations§

Source§

impl Debug for StorageError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for StorageError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for StorageError

Source§

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

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> TenantValidator for T

Source§

fn validate_tenant_context( &self, expected_tenant_id: &str, context: &RequestContext, ) -> Result<(), String>

Validate that the context has the expected tenant.
Source§

fn validate_single_tenant_context( &self, context: &RequestContext, ) -> Result<(), String>

Validate that the context is for single-tenant operation.
Source§

fn require_tenant_context(&self, context: &RequestContext) -> Result<(), String>

Extract tenant context or return error for multi-tenant operations.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,