[][src]Struct async_graphql::http::GQLError

pub struct GQLError<'a>(pub &'a Error);

Serializable error type

Methods from Deref<Target = Error>

pub fn backtrace(&self) -> &Backtrace[src]

Get the backtrace for this Error.

Backtraces are only available on the nightly channel. Tracking issue: rust-lang/rust#53487.

In order for the backtrace to be meaningful, the environment variable RUST_LIB_BACKTRACE=1 must be defined. Backtraces are somewhat expensive to capture in Rust, so we don't necessarily want to be capturing them all over the place all the time.

pub fn chain(&self) -> Chain[src]

An iterator of the chain of source errors contained by this Error.

This iterator will visit every error in the cause chain of this error object, beginning with the error that this error object was created from.

Example

use anyhow::Error;
use std::io;

pub fn underlying_io_error_kind(error: &Error) -> Option<io::ErrorKind> {
    for cause in error.chain() {
        if let Some(io_error) = cause.downcast_ref::<io::Error>() {
            return Some(io_error.kind());
        }
    }
    None
}

pub fn root_cause(&self) -> &(dyn Error + 'static)[src]

The lowest level cause of this error — this error's cause's cause's cause etc.

The root cause is the last error in the iterator produced by [chain()][Error::chain].

pub fn is<E>(&self) -> bool where
    E: Display + Debug + Send + Sync + 'static, 
[src]

Returns true if E is the type held by this error object.

For errors with context, this method returns true if E matches the type of the context C or the type of the error on which the context has been attached. For details about the interaction between context and downcasting, see here.

pub fn downcast_ref<E>(&self) -> Option<&E> where
    E: Display + Debug + Send + Sync + 'static, 
[src]

Downcast this error object by reference.

Example

// If the error was caused by redaction, then return a tombstone instead
// of the content.
match root_cause.downcast_ref::<DataStoreError>() {
    Some(DataStoreError::Censored(_)) => Ok(Poll::Ready(REDACTED_CONTENT)),
    None => Err(error),
}

Trait Implementations

impl<'a> Deref for GQLError<'a>[src]

type Target = Error

The resulting type after dereferencing.

impl<'a> Serialize for GQLError<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for GQLError<'a>

impl<'a> Send for GQLError<'a>

impl<'a> Sync for GQLError<'a>

impl<'a> Unpin for GQLError<'a>

impl<'a> UnwindSafe for GQLError<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,