pub enum StorageError {
Connection {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
Serialization {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
Deserialization {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
JobNotFound {
job_id: String,
},
Timeout {
timeout_ms: u64,
},
Unavailable {
reason: String,
},
Configuration {
message: String,
},
OperationFailed {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
CapacityExceeded {
message: String,
},
ConcurrentModification {
job_id: String,
},
MigrationError {
message: String,
},
InvalidJobData {
message: String,
},
}Expand description
Storage-specific errors that can occur during job persistence operations.
Every variant that wraps an underlying driver error carries a
source: Option<Box<dyn Error + Send + Sync>> field with #[source],
so callers can walk Error::source() or downcast to the concrete
type. Earlier revisions stringified the cause into message and
dropped the chain; the helper constructors here always preserve it.
Variants§
Connection
Connection-related errors (network, authentication, etc.)
Serialization
Encoding a value (job, state, metadata) into the storage’s transport format failed.
Deserialization
Decoding a value out of the storage’s transport format failed.
Distinct from [Serialization] so callers handling a corrupt-row
recovery path can match precisely.
JobNotFound
Job not found in storage
Timeout
Storage operation timed out
Storage is unavailable or down
Configuration
Configuration errors
OperationFailed
A storage-engine operation failed for a reason that isn’t a
connection / serialization / not-found / capacity issue. The
message field should already include enough operation context
(e.g. "Failed to fetch and lock job"); the underlying driver
error is preserved on source.
CapacityExceeded
Storage capacity exceeded
ConcurrentModification
Concurrent modification detected
MigrationError
Database migration errors
InvalidJobData
Invalid job data format
Implementations§
Source§impl StorageError
impl StorageError
Sourcepub fn connection<S: Into<String>>(message: S) -> Self
pub fn connection<S: Into<String>>(message: S) -> Self
Create a connection error with a message
Sourcepub fn connection_with_source<S: Into<String>>(
message: S,
source: Box<dyn Error + Send + Sync>,
) -> Self
pub fn connection_with_source<S: Into<String>>( message: S, source: Box<dyn Error + Send + Sync>, ) -> Self
Create a connection error with a message and source error
Sourcepub fn serialization<S: Into<String>>(message: S) -> Self
pub fn serialization<S: Into<String>>(message: S) -> Self
Create a serialization error with a message
Sourcepub fn serialization_with_source<S: Into<String>>(
message: S,
source: Box<dyn Error + Send + Sync>,
) -> Self
pub fn serialization_with_source<S: Into<String>>( message: S, source: Box<dyn Error + Send + Sync>, ) -> Self
Create a serialization error with a message and source error
Sourcepub fn deserialization<S: Into<String>>(message: S) -> Self
pub fn deserialization<S: Into<String>>(message: S) -> Self
Create a deserialization error with a message
Sourcepub fn deserialization_with_source<S: Into<String>>(
message: S,
source: Box<dyn Error + Send + Sync>,
) -> Self
pub fn deserialization_with_source<S: Into<String>>( message: S, source: Box<dyn Error + Send + Sync>, ) -> Self
Create a deserialization error with a message and source error
Sourcepub fn job_not_found<S: Into<String>>(job_id: S) -> Self
pub fn job_not_found<S: Into<String>>(job_id: S) -> Self
Create a job not found error
Create an unavailable error
Sourcepub fn configuration<S: Into<String>>(message: S) -> Self
pub fn configuration<S: Into<String>>(message: S) -> Self
Create a configuration error
Sourcepub fn operation_failed<S: Into<String>>(message: S) -> Self
pub fn operation_failed<S: Into<String>>(message: S) -> Self
Create an operation-failed error without a source (e.g. when the failure is logical, not driven by an underlying driver error).
Sourcepub fn operation_failed_with_source<S: Into<String>>(
message: S,
source: Box<dyn Error + Send + Sync>,
) -> Self
pub fn operation_failed_with_source<S: Into<String>>( message: S, source: Box<dyn Error + Send + Sync>, ) -> Self
Create an operation-failed error with a captured source.
Sourcepub fn capacity_exceeded<S: Into<String>>(message: S) -> Self
pub fn capacity_exceeded<S: Into<String>>(message: S) -> Self
Create a capacity exceeded error
Sourcepub fn concurrent_modification<S: Into<String>>(job_id: S) -> Self
pub fn concurrent_modification<S: Into<String>>(job_id: S) -> Self
Create a concurrent modification error
Sourcepub fn conn_err<M, E>(message: M, source: E) -> Self
pub fn conn_err<M, E>(message: M, source: E) -> Self
Connection shorthand that takes the raw error as a typed
generic, boxes it, and attaches it as the source — saves the
caller a Box::new(...).
Sourcepub fn ser_err<M, E>(message: M, source: E) -> Self
pub fn ser_err<M, E>(message: M, source: E) -> Self
Serialization shorthand with a captured source.
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
use the Display impl or to_string()