[][src]Struct nakadion::publisher::NakadiApiError

pub struct NakadiApiError { /* fields omitted */ }

An error type to get insights on why an HTTP request failed

Implementations

impl NakadiApiError[src]

pub fn http<T: Into<StatusCode>>(status: T) -> Self[src]

Create an response based error from a StatusCode received from a server

pub fn io() -> Self[src]

Create an io based error.

pub fn other() -> Self[src]

Create an error for some other cause

pub fn http_problem<T: Into<HttpApiProblem>>(prob: T) -> Self[src]

Create an error from an HttpApiProblem.

Keep in mind that an HttpApiProblem can also be created from a StatusCode but in that case you should prefer NakadiApiError::http.

This will also set the HttpApiProblem as the cause for this error.

pub fn caused_by<E>(self, err: E) -> Self where
    E: StdError + Send + Sync + 'static, 
[src]

Add a cause to this error

pub fn with_context<T: Into<String>>(self, context: T) -> Self[src]

Add a message that adds context to the cause for this error.

pub fn with_flow_id<T: Into<FlowId>>(self, flow_id: T) -> Self[src]

Add a FlowId to this error

pub fn with_maybe_flow_id(self, flow_id: Option<FlowId>) -> Self[src]

pub fn flow_id(&self) -> Option<&FlowId>[src]

Returns the FlowId associated with this error

pub fn problem(&self) -> Option<&HttpApiProblem>[src]

Returns the HttpApiProblem associated with this error if the cause of this error was an HttpApiProblem

If the cause was not an HttpApiProblem None is returned.

pub fn try_into_problem(self) -> Result<HttpApiProblem, Self>[src]

Try to turn this error into an HttpApiProblem.

If the cause was not an HttpApiProblem Self is returned as an error.

pub fn status(&self) -> Option<StatusCode>[src]

Get the HttpStatusCode for this error if there is a status code associated with this error

pub fn is_client_error(&self) -> bool[src]

Returns true if there is a StatusCode and if it is a client error.

pub fn is_auth_error(&self) -> bool[src]

Returns true if there is a StatusCode and if it StatusCode::FORBIDDEN or StatusCode::UNAUTHORIZED.

pub fn is_server_error(&self) -> bool[src]

Returns true if there is a StatusCode and if it is a server error.

pub fn is_other_error(&self) -> bool[src]

Returns true if the error was created with NakadiApiError::other.

pub fn is_io_error(&self) -> bool[src]

Returns true if the error was created with NakadiApiError::io.

Trait Implementations

impl Debug for NakadiApiError[src]

impl Display for NakadiApiError[src]

impl Error for NakadiApiError[src]

impl From<Elapsed> for NakadiApiError[src]

impl From<Error> for NakadiApiError[src]

impl From<InvalidHeaderValue> for NakadiApiError[src]

impl From<InvalidUri> for NakadiApiError[src]

impl From<IoError> for NakadiApiError[src]

impl From<NakadiApiError> for Error[src]

impl From<NakadiApiError> for PublishError[src]

impl From<NakadiApiError> for CommitError[src]

impl From<NakadiApiError> for ConnectError[src]

impl From<RemoteCallError> for NakadiApiError[src]

impl From<TokenError> for NakadiApiError[src]

Auto Trait Implementations

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> ToString for T where
    T: Display + ?Sized
[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>,