Skip to main content

Error

Enum Error 

Source
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 Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<SystemTimeError> for Error

Source§

fn from(e: SystemTimeError) -> Self

Converts to this type from the input type.
Source§

impl From<TryFromIntError> for Error

Source§

fn from(e: TryFromIntError) -> Self

Converts to this type from the input type.
Source§

impl IntoResponse for Error

Source§

fn into_response(self) -> Response

Create a response.
Source§

impl Loggable for Error

Source§

fn log_level(&self) -> Level

Returns the severity level that should be assigned to this error in the log.
Source§

fn log_module(&self) -> Module

Returns the server module responsible for this error. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Color for T
where T: Display,

Source§

fn bold(&self) -> String

Wraps the value in bold ANSI escape codes.
Source§

fn debug(&self) -> String

Wraps the value in grey ANSI escape codes, used for low-priority debug output.
Source§

fn error(&self) -> String

Wraps the value in red ANSI escape codes, used for errors.
Source§

fn info(&self) -> String

Wraps the value in cyan ANSI escape codes, used for informational messages.
Source§

fn italic(&self) -> String

Wraps the value in italic (dim) ANSI escape codes.
Source§

fn warn(&self) -> String

Wraps the value in yellow ANSI escape codes, used for warnings.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more