pub struct ApiError { /* private fields */ }Expand description
A structured API error. Serializes to { "error": { code, message } } with
the matching HTTP status.
Implementations§
Source§impl ApiError
impl ApiError
A 401 for a missing/blank credential.
Sourcepub fn bad_request(message: impl Into<String>) -> Self
pub fn bad_request(message: impl Into<String>) -> Self
A 400 for a malformed request the edge itself rejects.
Sourcepub fn from_brain(err: &BrainError) -> Self
pub fn from_brain(err: &BrainError) -> Self
Map a Brain client error to the matching HTTP status. Transport faults and
unavailable/exhausted verdicts are 503; auth verdicts 401/403;
validation/not-found/conflict map directly; anything else is 502.
Trait Implementations§
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