pub enum Error {
Show 13 variants
Unauthorized,
NotFound {
resource: String,
},
InternalServerError {
source: Option<Report>,
},
Sqlx {
source: Error,
},
MigrationError {
source: MigrateError,
},
IdentityNotFound {
key_id: String,
},
PayloadTooLarge,
MissingHeader {
header: String,
},
InvalidHeader {
header: String,
},
Whatever {
message: String,
source: Option<Report>,
},
InvalidParameter {
message: String,
},
InvalidMethod {
message: String,
},
MissingParameter {
message: String,
},
}Expand description
The main error enum that represents all possible errors in the application. Each variant includes context-specific information and appropriate error messages.
Variants§
NotFound
InternalServerError
Sqlx
MigrationError
Fields
§
source: MigrateErrorIdentityNotFound
PayloadTooLarge
MissingHeader
InvalidHeader
Whatever
InvalidParameter
InvalidMethod
MissingParameter
Implementations§
Source§impl Error
Convenience methods for creating common error types
impl Error
Convenience methods for creating common error types
Sourcepub fn internal(e: impl Into<Report>) -> Self
pub fn internal(e: impl Into<Report>) -> Self
Creates a new internal server error with a source error
Sourcepub fn not_found(resource: impl Into<String>) -> Self
pub fn not_found(resource: impl Into<String>) -> Self
Creates a not found error for a generic resource
pub fn invalid_parameter(message: impl Into<String>) -> Self
pub fn missing_parameter(message: impl Into<String>) -> Self
Sourcepub fn queue_not_found(
queue: impl Into<String>,
namespace: impl Into<String>,
) -> Self
pub fn queue_not_found( queue: impl Into<String>, namespace: impl Into<String>, ) -> Self
Creates a not found error specifically for queues within a namespace
Sourcepub fn namespace_not_found(namespace: impl Into<String>) -> Self
pub fn namespace_not_found(namespace: impl Into<String>) -> Self
Creates a not found error specifically for namespaces
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§fn cause(&self) -> Option<&dyn Error>
fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§impl ErrorCompat for Error
impl ErrorCompat for Error
Source§fn iter_chain(&self) -> ChainCompat<'_, '_>where
Self: AsErrorSource,
fn iter_chain(&self) -> ChainCompat<'_, '_>where
Self: AsErrorSource,
Returns an iterator for traversing the chain of errors,
starting with the current error
and continuing with recursive calls to
Error::source. Read moreSource§impl From<GetIdentityError> for Error
impl From<GetIdentityError> for Error
Source§fn from(_: GetIdentityError) -> Self
fn from(_: GetIdentityError) -> Self
Converts to this type from the input type.
Source§impl From<MigrateError> for Error
impl From<MigrateError> for Error
Source§fn from(source: MigrateError) -> Self
fn from(source: MigrateError) -> Self
Converts to this type from the input type.
Source§impl FromString for Error
impl FromString for Error
Source§impl ResponseError for Error
Maps internal errors to HTTP status codes for API responses.
This implementation ensures consistent error handling across the API.
impl ResponseError for Error
Maps internal errors to HTTP status codes for API responses. This implementation ensures consistent error handling across the API.
Source§fn status_code(&self) -> StatusCode
fn status_code(&self) -> StatusCode
Returns appropriate status code for error. Read more
Source§fn error_response(&self) -> HttpResponse
fn error_response(&self) -> HttpResponse
Creates full response for error. Read more
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations§
Source§impl<T> AsErrorSource for Twhere
T: Error + 'static,
impl<T> AsErrorSource for Twhere
T: Error + 'static,
Source§fn as_error_source(&self) -> &(dyn Error + 'static)
fn as_error_source(&self) -> &(dyn Error + 'static)
For maximum effectiveness, this needs to be called as a method
to benefit from Rust’s automatic dereferencing of method
receivers.
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 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>
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 moreCreates a shared type from an unshared type.