pub struct ApiError { /* private fields */ }Expand description
Translates LifecycleHandleError variants into HTTP status + JSON
body. Kept as a plain struct (not an enum) because every handler
reduces failures to one of three buckets: not found, not yet
implemented, or runtime fault.
Implementations§
Source§impl ApiError
impl ApiError
Sourcepub fn unknown_resource(name: impl Into<String>) -> Self
pub fn unknown_resource(name: impl Into<String>) -> Self
404 with {"error":"unknown resource","resource":"<name>"}.
Sourcepub fn not_supported(op: &'static str) -> Self
pub fn not_supported(op: &'static str) -> Self
501 with {"error":"not supported","resource":null}.
Trait Implementations§
Source§impl From<LifecycleHandleError> for ApiError
impl From<LifecycleHandleError> for ApiError
Source§fn from(err: LifecycleHandleError) -> Self
fn from(err: LifecycleHandleError) -> 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