pub struct ApiError { /* private fields */ }Expand description
An error response of every Kellnr endpoint, in the format of the cargo
registry API: {"errors":[{"detail":"..."}]}.
Implementations§
Source§impl ApiError
impl ApiError
Sourcepub fn new(msg: &str, status: StatusCode) -> Self
pub fn new(msg: &str, status: StatusCode) -> Self
An error with msg as its detail.
pub fn bad_request(msg: impl Display) -> Self
pub fn forbidden(msg: impl Display) -> Self
pub fn not_found(msg: impl Display) -> Self
pub fn conflict(msg: impl Display) -> Self
A 503 error that asks the client to retry after retry_after.
pub fn status(&self) -> StatusCode
pub fn from_err(e: &dyn Error, status: StatusCode) -> Self
Trait Implementations§
Source§impl From<AccountNameError> for ApiError
impl From<AccountNameError> for ApiError
Source§fn from(e: AccountNameError) -> Self
fn from(e: AccountNameError) -> Self
Converts to this type from the input type.
Source§impl From<StatusCode> for ApiError
An error without further details than its status code.
impl From<StatusCode> for ApiError
An error without further details than its status code.
Source§fn from(status: StatusCode) -> Self
fn from(status: StatusCode) -> Self
Converts to this type from the input type.
Source§impl From<StorageError> for ApiError
impl From<StorageError> for ApiError
Source§fn from(e: StorageError) -> Self
fn from(e: StorageError) -> Self
Converts to this type from the input type.
Source§impl From<VersionError> for ApiError
impl From<VersionError> for ApiError
Source§fn from(e: VersionError) -> Self
fn from(e: VersionError) -> 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 Forget for ApiError
impl Freeze for ApiError
impl Move 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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more