pub enum Error {
StorageError(Error),
ApiError(Error),
Conflict(String),
DatabaseError(Error),
InternalError(Error),
ModelError(Error),
}Expand description
The top-level application error.
This is the single error type returned by all route handlers via crate::Result<T>.
It acts as the central hub that aggregates errors from every domain in the application
(API layer, storage layer, model layer) through From implementations generated by thiserror.
§How errors flow
When a route handler uses the ? operator, errors bubble up through the following chain:
model::Error ──┐
storage::Error ──┼──► Error ──► IntoResponse (sanitized HTTP response)
api::Error ───┘The IntoResponse implementation here is the single point of truth for what the
HTTP client is allowed to see. It logs the full internal error (for the server admin)
and then delegates to each domain’s own IntoResponse to produce a sanitized response.
Variants§
StorageError(Error)
A storage layer error, typically a filesystem or CAS transaction failure.
ApiError(Error)
An API layer error, typically a bad request or auth failure from a route handler.
Conflict(String)
A conflict at the application level, such as a duplicate user registration. This is distinct from a database uniqueness error — it is raised intentionally by business logic in route handlers.
DatabaseError(Error)
A raw database error that was not caught and converted by the model layer.
In practice this should be rare, as most DB queries go through model::Error.
InternalError(Error)
A low-level internal error, typically from integer or time conversions.
ModelError(Error)
A model layer error, covering database query results and domain-specific failures (e.g., asset not found, uniqueness violations).
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()
Source§impl From<SystemTimeError> for Error
impl From<SystemTimeError> for Error
Source§fn from(e: SystemTimeError) -> Self
fn from(e: SystemTimeError) -> Self
Source§impl From<TryFromIntError> for Error
impl From<TryFromIntError> for Error
Source§fn from(e: TryFromIntError) -> Self
fn from(e: TryFromIntError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Color for Twhere
T: Display,
impl<T> Color for Twhere
T: Display,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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