pub enum RustisanError {
Show 21 variants
ConfigError(String),
RoutingError(String),
DatabaseError(String),
ValidationError(String),
AuthenticationError(String),
AuthorizationError(String),
BadRequest(String),
Unauthorized(String),
Forbidden(String),
NotFound(String),
MethodNotAllowed(String),
Conflict(String),
UnprocessableEntity(String),
TooManyRequests(String),
InternalError(String),
ServiceUnavailable(String),
IoError(String),
SerializationError(String),
NetworkError(String),
TimeoutError(String),
ApplicationError {
code: String,
message: String,
details: Option<Value>,
},
}
Expand description
Main error type for the Rustisan framework
Variants§
ConfigError(String)
Configuration errors
RoutingError(String)
Routing errors
DatabaseError(String)
Database errors
ValidationError(String)
Validation errors
AuthenticationError(String)
Authentication errors
AuthorizationError(String)
Authorization errors
BadRequest(String)
Bad request errors (400)
Unauthorized errors (401)
Forbidden(String)
Forbidden errors (403)
NotFound(String)
Not found errors (404)
MethodNotAllowed(String)
Method not allowed errors (405)
Conflict(String)
Conflict errors (409)
UnprocessableEntity(String)
Unprocessable entity errors (422)
TooManyRequests(String)
Too many requests errors (429)
InternalError(String)
Internal server errors (500)
Service unavailable errors (503)
IoError(String)
IO errors
SerializationError(String)
Serialization errors
NetworkError(String)
Network errors
TimeoutError(String)
Timeout errors
ApplicationError
Custom application errors
Implementations§
Source§impl RustisanError
impl RustisanError
Sourcepub fn validation<S: Into<String>>(message: S) -> Self
pub fn validation<S: Into<String>>(message: S) -> Self
Creates a new validation error
Sourcepub fn authentication<S: Into<String>>(message: S) -> Self
pub fn authentication<S: Into<String>>(message: S) -> Self
Creates a new authentication error
Creates a new authorization error
Sourcepub fn bad_request<S: Into<String>>(message: S) -> Self
pub fn bad_request<S: Into<String>>(message: S) -> Self
Creates a new bad request error
Creates a new unauthorized error
Sourcepub fn method_not_allowed<S: Into<String>>(message: S) -> Self
pub fn method_not_allowed<S: Into<String>>(message: S) -> Self
Creates a new method not allowed error
Sourcepub fn unprocessable_entity<S: Into<String>>(message: S) -> Self
pub fn unprocessable_entity<S: Into<String>>(message: S) -> Self
Creates a new unprocessable entity error
Sourcepub fn too_many_requests<S: Into<String>>(message: S) -> Self
pub fn too_many_requests<S: Into<String>>(message: S) -> Self
Creates a new too many requests error
Creates a new service unavailable error
Sourcepub fn application<S: Into<String>>(code: S, message: S) -> Self
pub fn application<S: Into<String>>(code: S, message: S) -> Self
Creates a new custom application error
Sourcepub fn application_with_details<S: Into<String>>(
code: S,
message: S,
details: Value,
) -> Self
pub fn application_with_details<S: Into<String>>( code: S, message: S, details: Value, ) -> Self
Creates a new custom application error with details
Sourcepub fn status_code(&self) -> StatusCode
pub fn status_code(&self) -> StatusCode
Gets the HTTP status code for this error
Sourcepub fn error_code(&self) -> &str
pub fn error_code(&self) -> &str
Gets the error code
Sourcepub fn is_client_error(&self) -> bool
pub fn is_client_error(&self) -> bool
Checks if this is a client error (4xx)
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Checks if this is a server error (5xx)
Trait Implementations§
Source§impl Clone for RustisanError
impl Clone for RustisanError
Source§fn clone(&self) -> RustisanError
fn clone(&self) -> RustisanError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for RustisanError
impl Debug for RustisanError
Source§impl<'de> Deserialize<'de> for RustisanError
impl<'de> Deserialize<'de> for RustisanError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for RustisanError
impl Display for RustisanError
Source§impl Error for RustisanError
impl Error for RustisanError
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
Source§impl From<Error> for RustisanError
impl From<Error> for RustisanError
Source§impl From<Error> for RustisanError
impl From<Error> for RustisanError
Source§impl From<Error> for RustisanError
impl From<Error> for RustisanError
Source§impl From<Error> for RustisanError
impl From<Error> for RustisanError
Source§impl IntoResponse for RustisanError
impl IntoResponse for RustisanError
Source§fn into_response(self) -> AxumResponse
fn into_response(self) -> AxumResponse
Auto Trait Implementations§
impl Freeze for RustisanError
impl RefUnwindSafe for RustisanError
impl Send for RustisanError
impl Sync for RustisanError
impl Unpin for RustisanError
impl UnwindSafe for RustisanError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, S> Handler<IntoResponseHandler, S> for T
impl<T, S> Handler<IntoResponseHandler, S> for T
Source§fn call(
self,
_req: Request<Body>,
_state: S,
) -> <T as Handler<IntoResponseHandler, S>>::Future
fn call( self, _req: Request<Body>, _state: S, ) -> <T as Handler<IntoResponseHandler, S>>::Future
Source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
tower::Layer
to the handler. Read moreSource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Service
by providing the stateSource§impl<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
Source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Service
and no state.Source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
MakeService
and no state. Read moreSource§fn into_make_service_with_connect_info<C>(
self,
) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
fn into_make_service_with_connect_info<C>( self, ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
MakeService
which stores information
about the incoming connection and has no state. Read more