pub struct ErrorResponse {
pub message: String,
pub error_code: Cow<'static, str>,
pub details: Value,
}Expand description
Information returned by REST API endpoints on error.
Fields§
§message: StringHuman-readable error message.
error_code: Cow<'static, str>Error code is a string that specifies this error type.
details: ValueDetailed error metadata.
The contents of this field is determined by error_code.
Implementations§
Source§impl ErrorResponse
impl ErrorResponse
pub fn from_error<E>(error: &E) -> Selfwhere
E: DetailedError,
pub fn from_error_nolog<E>(error: &E) -> Selfwhere
E: DetailedError,
Trait Implementations§
Source§impl Clone for ErrorResponse
impl Clone for ErrorResponse
Source§fn clone(&self) -> ErrorResponse
fn clone(&self) -> ErrorResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ErrorResponse
impl Debug for ErrorResponse
Source§impl<'de> Deserialize<'de> for ErrorResponse
impl<'de> Deserialize<'de> for ErrorResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<E> From<&E> for ErrorResponsewhere
E: DetailedError,
impl<E> From<&E> for ErrorResponsewhere
E: DetailedError,
Source§fn from(error: &E) -> ErrorResponse
fn from(error: &E) -> ErrorResponse
Transform the detailed error to a complete JSON error response.
- The message is retrieved using
to_string()(available due to traitStdError) - The status code determines the level of the log statement during this function
(available due to trait
ResponseError) - The details are retrieved by serializing to JSON (available due to trait
Serialize)
Source§impl PartialEq for ErrorResponse
impl PartialEq for ErrorResponse
Source§impl Serialize for ErrorResponse
impl Serialize for ErrorResponse
Source§impl<'__s> ToSchema<'__s> for ErrorResponse
impl<'__s> ToSchema<'__s> for ErrorResponse
impl Eq for ErrorResponse
impl StructuralPartialEq for ErrorResponse
Auto Trait Implementations§
impl Freeze for ErrorResponse
impl RefUnwindSafe for ErrorResponse
impl Send for ErrorResponse
impl Sync for ErrorResponse
impl Unpin for ErrorResponse
impl UnwindSafe for ErrorResponse
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.