pub struct ReductError<Original = ()> {
pub status: ErrorCode,
pub message: String,
pub source: Option<Original>,
}Expand description
An HTTP error, we use it for error handling.
Fields§
§status: ErrorCodeThe HTTP status code.
message: StringThe human-readable message.
source: Option<Original>The original err
Implementations§
Source§impl<Original> ReductError<Original>
impl<Original> ReductError<Original>
Sourcepub fn without_source(self) -> ReductError
pub fn without_source(self) -> ReductError
Convert to a plain ReductError by dropping the original source type.
pub fn with_source<T>(self, source: T) -> ReductError<T>
Source§impl ReductError
impl ReductError
pub fn new(status: ErrorCode, message: &str) -> Self
pub fn status(&self) -> ErrorCode
pub fn message(&self) -> &str
pub fn ok() -> ReductError
pub fn timeout(msg: &str) -> ReductError
Sourcepub fn no_content(msg: &str) -> ReductError
pub fn no_content(msg: &str) -> ReductError
Create a no content error.
Sourcepub fn not_found(msg: &str) -> ReductError
pub fn not_found(msg: &str) -> ReductError
Create a not found error.
Sourcepub fn conflict(msg: &str) -> ReductError
pub fn conflict(msg: &str) -> ReductError
Create a conflict error.
Sourcepub fn bad_request(msg: &str) -> ReductError
pub fn bad_request(msg: &str) -> ReductError
Create a bad request error.
Create an unauthorized error.
Sourcepub fn forbidden(msg: &str) -> ReductError
pub fn forbidden(msg: &str) -> ReductError
Create a forbidden error.
Sourcepub fn unprocessable_entity(msg: &str) -> ReductError
pub fn unprocessable_entity(msg: &str) -> ReductError
Create an unprocessable entity error.
Sourcepub fn too_early(msg: &str) -> ReductError
pub fn too_early(msg: &str) -> ReductError
Create a too early error.
Sourcepub fn internal_server_error(msg: &str) -> ReductError
pub fn internal_server_error(msg: &str) -> ReductError
Create a bad request error.
Trait Implementations§
Source§impl<Original: Clone> Clone for ReductError<Original>
impl<Original: Clone> Clone for ReductError<Original>
Source§fn clone(&self) -> ReductError<Original>
fn clone(&self) -> ReductError<Original>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<Original: Debug> Debug for ReductError<Original>
impl<Original: Debug> Debug for ReductError<Original>
Source§impl<Original> Display for ReductError<Original>
impl<Original> Display for ReductError<Original>
Source§impl Error for ReductError
impl Error for ReductError
Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
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
Source§impl From<Error> for ReductError
impl From<Error> for ReductError
Source§impl From<ParseError> for ReductError<ParseError>
impl From<ParseError> for ReductError<ParseError>
Source§fn from(err: ParseError) -> Self
fn from(err: ParseError) -> Self
Converts to this type from the input type.
Source§impl<T> From<PoisonError<T>> for ReductError<PoisonError<T>>
impl<T> From<PoisonError<T>> for ReductError<PoisonError<T>>
Source§fn from(err: PoisonError<T>) -> Self
fn from(err: PoisonError<T>) -> Self
Converts to this type from the input type.
Source§impl From<SystemTimeError> for ReductError<SystemTimeError>
impl From<SystemTimeError> for ReductError<SystemTimeError>
Source§fn from(err: SystemTimeError) -> Self
fn from(err: SystemTimeError) -> Self
Converts to this type from the input type.
Source§impl<Original: PartialEq> PartialEq for ReductError<Original>
impl<Original: PartialEq> PartialEq for ReductError<Original>
Source§fn eq(&self, other: &ReductError<Original>) -> bool
fn eq(&self, other: &ReductError<Original>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<Original: PartialEq> StructuralPartialEq for ReductError<Original>
Auto Trait Implementations§
impl<Original> Freeze for ReductError<Original>where
Original: Freeze,
impl<Original> RefUnwindSafe for ReductError<Original>where
Original: RefUnwindSafe,
impl<Original> Send for ReductError<Original>where
Original: Send,
impl<Original> Sync for ReductError<Original>where
Original: Sync,
impl<Original> Unpin for ReductError<Original>where
Original: Unpin,
impl<Original> UnsafeUnpin for ReductError<Original>where
Original: UnsafeUnpin,
impl<Original> UnwindSafe for ReductError<Original>where
Original: UnwindSafe,
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