pub enum Error {
Show 22 variants
NotFound(String),
ConfigMismatch,
InvalidOffset(String),
ContentTypeMismatch {
expected: String,
actual: String,
},
StreamClosed,
SequenceGap {
expected: u64,
actual: u64,
},
EpochFenced {
current: u64,
received: u64,
},
InvalidProducerState(String),
MemoryLimitExceeded,
StreamSizeLimitExceeded,
InvalidTtl(String),
ConflictingExpiration,
StreamExpired,
InvalidJson(String),
EmptyBody,
EmptyArray,
InvalidHeader {
header: String,
reason: String,
},
InvalidStreamName(String),
SeqOrderingViolation {
last: String,
received: String,
},
Unavailable(StorageFailure),
InsufficientStorage(StorageFailure),
Storage(String),
}Expand description
Single error type for all storage and protocol operations
Maps to HTTP status codes in handlers. Following the single error enum pattern to avoid error type proliferation.
Variants§
NotFound(String)
Stream not found (404)
ConfigMismatch
Stream already exists with different config (409)
InvalidOffset(String)
Invalid offset format (400)
ContentTypeMismatch
Content type mismatch (409)
StreamClosed
Stream is closed (409)
SequenceGap
Producer sequence gap (409)
EpochFenced
Producer epoch fenced (403)
InvalidProducerState(String)
Invalid producer state (400)
MemoryLimitExceeded
Memory limit exceeded (413)
StreamSizeLimitExceeded
Stream size limit exceeded (413)
InvalidTtl(String)
Invalid TTL format (400)
ConflictingExpiration
Both TTL and Expires-At provided (400)
StreamExpired
Stream has expired (404)
InvalidJson(String)
Invalid JSON (400)
EmptyBody
Empty request body when data is required (400)
EmptyArray
Empty JSON array append body (400)
InvalidHeader
Invalid header value (400)
InvalidStreamName(String)
Invalid stream name (400)
SeqOrderingViolation
Stream-Seq ordering violation (409)
Storage backend is temporarily unavailable (503)
InsufficientStorage(StorageFailure)
Storage backend has insufficient capacity (507)
Storage(String)
Storage backend I/O or serialization error (500)
Implementations§
Source§impl Error
impl Error
Sourcepub fn status_code(&self) -> StatusCode
pub fn status_code(&self) -> StatusCode
Map error to HTTP status code
This is the single place where errors are mapped to status codes. Handlers should use this method to determine the response code.
pub fn storage_insufficient( backend: &'static str, operation: impl Into<String>, detail: impl Into<String>, ) -> Self
pub fn classify_io_failure( backend: &'static str, operation: impl Into<String>, detail: impl Into<String>, error: &Error, ) -> Self
pub fn is_retryable_io_error(error: &Error) -> bool
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · 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()
Source§impl From<Error> for ProblemResponse
impl From<Error> for ProblemResponse
Source§impl IntoResponse for Error
Convert Error to HTTP response
impl IntoResponse for Error
Convert Error to HTTP response