pub enum Error {
Backend(Box<dyn Error + Send + Sync>),
Json(Error),
NotFound(String),
JobNotFound {
queue_name: String,
id: String,
},
RateLimitExceeded {
current: f64,
limit: i32,
reset_at: OffsetDateTime,
},
LockFailed(String),
LockTimeout(i32),
PayloadTooLarge {
size: usize,
max_size: usize,
},
ChannelClosed(String),
}Expand description
Errors that can occur during infrastructure operations.
Backend-specific errors (sqlx, redis, etc.) are wrapped in Error::Backend.
Variants§
Backend(Box<dyn Error + Send + Sync>)
Backend-specific error (sqlx::Error, redis::Error, etc.).
Json(Error)
JSON serialization/deserialization error.
NotFound(String)
Key not found in cache or counter.
JobNotFound
Job not found in queue.
After the PARTITION BY LIST (queue_name) migration, every id-based
JobQueue operation scopes the lookup to a specific partition via
queue_name. A JobNotFound can therefore mean either “no job with
this id in this queue” (the genuine case) or “the caller passed the
wrong queue_name for a real id” (a programming bug). Carrying both
fields lets operators distinguish the two in logs.
Fields
RateLimitExceeded
Rate limit exceeded.
Fields
reset_at: OffsetDateTimeWhen the rate limit resets.
LockFailed(String)
Lock acquisition failed (already held by another session).
LockTimeout(i32)
Lock acquisition timed out.
PayloadTooLarge
Payload too large for the backend’s notification limit.
ChannelClosed(String)
Internal channel closed (background task exited).
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_rate_limited(&self) -> bool
pub fn is_rate_limited(&self) -> bool
Returns true if this is a rate limit exceeded error.
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Returns true if this is a not found error.
Sourcepub fn is_lock_error(&self) -> bool
pub fn is_lock_error(&self) -> bool
Returns true if this is a lock-related error.
Sourcepub fn reset_at(&self) -> Option<OffsetDateTime>
pub fn reset_at(&self) -> Option<OffsetDateTime>
Extract rate limit reset time if this is a rate limit error.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()