Struct perseus::errors::BlamedError

source ·
pub struct BlamedError<E: Send + Sync> {
    pub error: E,
    pub blame: ErrorBlame,
}
Expand description

An error that has an attached cause that blames either the client or the server for its occurrence. You can convert any error into this with .into() or ?, which will set the cause to the server by default, resulting in a 500 Internal Server Error HTTP status code. If this isn’t what you want, you’ll need to initialize this explicitly.

Note for those using anyhow: use .map_err(|e| anyhow::anyhow!(e))? to use anyhow in Perseus render functions.

Fields§

§error: E

The underlying error.

§blame: ErrorBlame

Who is to blame for the error.

Trait Implementations§

source§

impl<E: Debug + Send + Sync> Debug for BlamedError<E>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<E: Into<Box<dyn Error + Send + Sync + 'static>> + Send + Sync> From<E> for BlamedError<E>

source§

fn from(error: E) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<E> RefUnwindSafe for BlamedError<E>where E: RefUnwindSafe,

§

impl<E> Send for BlamedError<E>

§

impl<E> Sync for BlamedError<E>

§

impl<E> Unpin for BlamedError<E>where E: Unpin,

§

impl<E> UnwindSafe for BlamedError<E>where E: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<!> for T

source§

fn from(t: !) -> T

Converts to this type from the input type.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.