pub enum ApiError {
Unauthorized(String),
Forbidden(String),
BadRequest(String),
NotFound(String),
Internal(String),
}Expand description
An error surfaced by an API handler, carrying enough to pick an HTTP
status and a stable machine-readable type tag.
Variants§
Missing or invalid bearer token (401).
Forbidden(String)
The action is understood but not permitted — e.g. a Destructive tool
invoked while allow_destructive is off (403).
BadRequest(String)
The request was malformed or referenced something missing (400).
NotFound(String)
A referenced resource does not exist (404).
Internal(String)
Anything else — an internal failure (500).
Trait Implementations§
Source§impl Error for ApiError
impl Error for ApiError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<AonyxError> for ApiError
impl From<AonyxError> for ApiError
Source§fn from(e: AonyxError) -> Self
fn from(e: AonyxError) -> Self
Converts to this type from the input type.
Source§impl IntoResponse for ApiError
impl IntoResponse for ApiError
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Create a response.
Auto Trait Implementations§
impl Freeze for ApiError
impl RefUnwindSafe for ApiError
impl Send for ApiError
impl Sync for ApiError
impl Unpin for ApiError
impl UnsafeUnpin for ApiError
impl UnwindSafe for ApiError
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
Mutably borrows from an owned value. Read more