pub struct Error {
pub code: u16,
pub message: String,
pub errors: Option<IndexMap<String, String>>,
pub platform_native_object: Option<Arc<dyn Any + Send + Sync>>,
}
Fields§
§code: u16
§message: String
§errors: Option<IndexMap<String, String>>
§platform_native_object: Option<Arc<dyn Any + Send + Sync>>
Implementations§
Source§impl Error
impl Error
pub fn new(message: impl Into<String>) -> Self
pub fn new_with_code(message: impl Into<String>, code: u16) -> Self
pub fn new_with_code_errors( message: impl Into<String>, code: u16, errors: IndexMap<String, String>, ) -> Self
pub fn new_pathed( message: impl Into<String>, code: u16, key: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn message_prefixed(&self, prefix: impl AsRef<str>) -> Self
pub fn path_prefixed(&self, prefix: impl AsRef<str>) -> Self
pub fn pathed(&self, prefix: impl AsRef<str>) -> Self
pub fn map_path<F>(&self, mapper: F) -> Self
pub fn code(&self) -> u16
pub fn message(&self) -> &str
pub fn errors(&self) -> Option<&IndexMap<String, String>>
pub fn assign_platform_native_object<T: 'static + Send + Sync>( &mut self, val: T, )
pub fn platform_native_object<T: 'static + Send>(&self) -> Option<&T>
pub fn inferred_title(&self) -> Cow<'static, str>
pub fn not_found() -> Self
pub fn not_found_message(message: impl Into<String>) -> Self
pub fn not_found_pathed( path: impl Into<String>, message: impl Into<String>, ) -> Self
pub fn invalid_request() -> Self
pub fn invalid_request_message(message: impl Into<String>) -> Self
pub fn invalid_request_pathed( path: impl Into<String>, message: impl Into<String>, ) -> Self
pub fn unique_error( path: impl Into<String>, constraint: impl AsRef<str>, ) -> Self
pub fn internal_server_error() -> Self
pub fn internal_server_error_message(message: impl Into<String>) -> Self
pub fn internal_server_error_pathed( path: impl Into<String>, message: impl Into<String>, ) -> Self
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · 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 From<Infallible> for Error
impl From<Infallible> for Error
Source§fn from(value: Infallible) -> Self
fn from(value: Infallible) -> Self
Converts to this type from the input type.
Source§impl<T> From<PoisonError<MutexGuard<'_, T>>> for Error
impl<T> From<PoisonError<MutexGuard<'_, T>>> for Error
Source§fn from(value: PoisonError<MutexGuard<'_, T>>) -> Self
fn from(value: PoisonError<MutexGuard<'_, T>>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
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