pub struct ErrorInfo {
pub code: i32,
pub message: String,
pub details: Option<HashMap<String, String>>,
pub source: Option<Arc<dyn Error + Send + Sync + 'static>>,
}
Expand description
Struct to represent error information
Fields§
§code: i32
§message: String
§details: Option<HashMap<String, String>>
§source: Option<Arc<dyn Error + Send + Sync + 'static>>
Implementations§
Source§impl ErrorInfo
impl ErrorInfo
pub fn new(code: i32, message: impl Into<String>) -> Self
pub fn with_details(self, details: HashMap<String, String>) -> Self
pub fn with_detail( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn set_detail( &mut self, key: impl Into<String>, value: impl Into<String>, ) -> &mut Self
pub fn with_source(self, source: impl Error + Send + Sync + 'static) -> Self
pub fn set_source( &mut self, source: impl Error + Send + Sync + 'static, ) -> &mut Self
pub fn is<E: Error + 'static>(&self) -> bool
pub fn downcast_ref<E: Error + 'static>(&self) -> Option<&E>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ErrorInfo
impl<'de> Deserialize<'de> for ErrorInfo
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 Error for ErrorInfo
impl Error for ErrorInfo
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl<Data, Meta> From<ErrorInfo> for ApiResponse<Data, Meta>
impl<Data, Meta> From<ErrorInfo> for ApiResponse<Data, Meta>
Source§impl<Meta> From<ErrorInfo> for ErrorResponse<Meta>
impl<Meta> From<ErrorInfo> for ErrorResponse<Meta>
Auto Trait Implementations§
impl Freeze for ErrorInfo
impl !RefUnwindSafe for ErrorInfo
impl Send for ErrorInfo
impl Sync for ErrorInfo
impl Unpin for ErrorInfo
impl !UnwindSafe for ErrorInfo
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