pub struct ReductError {
pub status: ErrorCode,
pub message: String,
}
Expand description
An HTTP error, we use it for error handling.
Fields§
§status: ErrorCode
The HTTP status code.
message: String
The human readable message.
Implementations§
Source§impl ReductError
impl ReductError
pub fn new(status: ErrorCode, message: &str) -> ReductError
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 Clone for ReductError
impl Clone for ReductError
Source§fn clone(&self) -> ReductError
fn clone(&self) -> ReductError
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 ReductError
impl Debug for ReductError
Source§impl Display for ReductError
impl Display for ReductError
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§fn from(err: Error) -> ReductError
fn from(err: Error) -> ReductError
Converts to this type from the input type.
Source§impl From<ParseError> for ReductError
impl From<ParseError> for ReductError
Source§fn from(err: ParseError) -> ReductError
fn from(err: ParseError) -> ReductError
Converts to this type from the input type.
Source§impl<T> From<PoisonError<T>> for ReductError
impl<T> From<PoisonError<T>> for ReductError
Source§fn from(_: PoisonError<T>) -> ReductError
fn from(_: PoisonError<T>) -> ReductError
Converts to this type from the input type.
Source§impl From<SystemTimeError> for ReductError
impl From<SystemTimeError> for ReductError
Source§fn from(err: SystemTimeError) -> ReductError
fn from(err: SystemTimeError) -> ReductError
Converts to this type from the input type.
Source§impl PartialEq for ReductError
impl PartialEq for ReductError
impl StructuralPartialEq for ReductError
Auto Trait Implementations§
impl Freeze for ReductError
impl RefUnwindSafe for ReductError
impl Send for ReductError
impl Sync for ReductError
impl Unpin for ReductError
impl UnwindSafe for ReductError
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.