#[non_exhaustive]pub enum BackendError {
NotADatabase,
Locked,
Constraint(String),
Io(String),
Validation(String),
Unsupported {
capability: &'static str,
},
Other(String),
}Expand description
Backend-neutral error variants surfaced by the StorageBackend trait.
Marked #[non_exhaustive]: a future backend may surface failure modes the
native one cannot, so downstream code must not assume the variant set is
closed. Added before the trait’s first release so later additions stay
non-breaking.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotADatabase
The opened file is not a valid SQLite database, or is encrypted with the wrong key.
Locked
The database or a table within it is locked or busy.
Constraint(String)
A backend-level constraint (uniqueness, check, foreign key) was violated.
Io(String)
An I/O error from the backend.
Validation(String)
A client-facing validation failure raised by a backend method (for
example the tag-count limit in set_tags). Carries the original
message so From<BackendError> for DynoxideError can restore it as a
ValidationException rather than collapsing it to a 500.
Unsupported
A capability the active backend does not implement (for example streams,
TTL, or the cross-item TransactWriteItems action on the wasm backend).
Carries a static tag so callers can distinguish which capability was
refused. Surfaces as an InternalServerError through
From<BackendError> for DynoxideError.
Other(String)
Any other backend failure. Carries the original error’s Display output.
Trait Implementations§
Source§impl Debug for BackendError
impl Debug for BackendError
Source§impl Display for BackendError
impl Display for BackendError
Source§impl Error for BackendError
impl Error for BackendError
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<BackendError> for DynoxideError
Most backend failures (BackendError) are storage-level faults: a locked
database, an I/O error, a constraint the application layer did not
anticipate. None of those is part of DynamoDB’s client-facing error
contract, so they surface as InternalServerError (HTTP 500), matching how
a raw rusqlite::Error surfaces via SqliteError.
impl From<BackendError> for DynoxideError
Most backend failures (BackendError) are storage-level faults: a locked
database, an I/O error, a constraint the application layer did not
anticipate. None of those is part of DynamoDB’s client-facing error
contract, so they surface as InternalServerError (HTTP 500), matching how
a raw rusqlite::Error surfaces via SqliteError.
The one exception is BackendError::Validation: a backend method such as
set_tags enforces a client-facing limit (the 50-tag cap) and raises a
ValidationException. That crosses the trait boundary as
BackendError::Validation and is restored here to its ValidationException
(HTTP 400) so the envelope is unchanged from calling Storage directly.
A one-way From is deliberate rather than merging the two types:
BackendError is the narrow storage vocabulary, DynoxideError the wider
API vocabulary. A merge is deferred.