pub enum ApiError {
NotFound,
BadRequest(String),
VersionMismatch {
current: u64,
sent: String,
},
Db(Error),
Json(Error),
Internal(String),
}Expand description
Every error the sim’s HTTP handlers can raise.
Variants§
NotFound
Resource absent. Produces 404.
BadRequest(String)
Client-supplied input failed validation. Produces 400.
VersionMismatch
If-Match version did not match the current row’s version. Produces 409.
Fields
Db(Error)
Underlying SQLite error. Produces 500 (opaque body). The detailed
error is logged via tracing::error! server-side.
Json(Error)
Underlying JSON error. Produces 400 (request-side) or 500
(response-side). Handler code decides via ApiError::BadRequest which
side of the boundary the error came from; this variant is the escape
hatch for library-level Serde failures.
Internal(String)
Internal invariant violation (e.g. schema load returned Err, or a unicode assumption about label JSON failed). Produces 500 with an opaque body.
Implementations§
Trait Implementations§
Source§impl Error for ApiError
impl Error for ApiError
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 IntoResponse for ApiError
impl IntoResponse for ApiError
Source§fn into_response(self) -> Response
fn into_response(self) -> 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
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.