pub struct WebError {
    pub err_code: i32,
    pub err_msg: String,
    pub detail: Option<Value>,
}Expand description
A default error response for most API errors.
Fields§
§err_code: i32A unique error ID. A unique error code.
err_msg: StringAn error message.
detail: Option<Value>Optional Additional error details.
Implementations§
Source§impl WebError
 
impl WebError
pub fn new( err_code: i32, err_msg: impl Into<String>, detail: Option<Value>, ) -> Self
pub fn new_with_msg(err_msg: impl Into<String>) -> Self
pub fn new_with_code(err_code: i32, err_msg: impl Into<String>) -> Self
pub fn server_error_with_detail( err_msg: impl Into<String>, detail: Value, ) -> Self
pub fn with_err_code(self, err_code: i32) -> Self
pub fn with_details(self, details: Value) -> Self
pub fn with_err_msg(self, err_msg: impl Into<String>) -> Self
Create a 401 Unauthorized error
Sourcepub fn bad_request(err_msg: impl Into<String>) -> Self
 
pub fn bad_request(err_msg: impl Into<String>) -> Self
Create a 400 Bad Request error
Sourcepub fn bad_gateway(err_msg: impl Into<String>) -> Self
 
pub fn bad_gateway(err_msg: impl Into<String>) -> Self
Create a 502 Bad Gateway error
Trait Implementations§
Source§impl<'de> Deserialize<'de> for WebError
 
impl<'de> Deserialize<'de> for WebError
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 IntoResponse for WebError
 
impl IntoResponse for WebError
Source§fn into_response(self) -> Response
 
fn into_response(self) -> Response
Create a response.
Auto Trait Implementations§
impl Freeze for WebError
impl RefUnwindSafe for WebError
impl Send for WebError
impl Sync for WebError
impl Unpin for WebError
impl UnwindSafe for WebError
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