Enum EventError

Source
#[non_exhaustive]
pub enum EventError {
Show 14 variants HttpResponse(Box<Error>, Backtrace), InvalidBodyBase64(Box<DecodeError>, Backtrace), InvalidBodyJson(Box<Error<Error>>, Backtrace), InvalidBodyUtf8(Box<FromUtf8Error>, Backtrace), InvalidHeaderUtf8(HeaderName, Box<dyn Error + Send + Sync + 'static>, Backtrace), InvalidRequestPathParam { param_name: Cow<'static, str>, source: Option<Box<dyn Error + Send + Sync + 'static>>, backtrace: Backtrace, }, InvalidRequestQueryParam { param_name: Cow<'static, str>, source: Option<Box<dyn Error + Send + Sync + 'static>>, backtrace: Backtrace, }, MissingRequestBody(Backtrace), MissingRequestHeader(Cow<'static, str>, Backtrace), MissingRequestParam(Cow<'static, str>, Backtrace), Panic(String, Backtrace), ToJsonResponse { type_name: Cow<'static, str>, source: Box<Error<Error>>, backtrace: Backtrace, }, UnexpectedContentType(String, Backtrace), UnexpectedOperationId(String, Backtrace),
}
Expand description

Error that occurred while processing an AWS Lambda event.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

HttpResponse(Box<Error>, Backtrace)

Failed to prepare HTTP response.

§

InvalidBodyBase64(Box<DecodeError>, Backtrace)

Invalid base64 encoding for request body.

§

InvalidBodyJson(Box<Error<Error>>, Backtrace)

Failed to JSON deserialize request body.

§

InvalidBodyUtf8(Box<FromUtf8Error>, Backtrace)

Invalid UTF-8 encoding for request body.

§

InvalidHeaderUtf8(HeaderName, Box<dyn Error + Send + Sync + 'static>, Backtrace)

Invalid UTF-8 encoding for request header.

§

InvalidRequestPathParam

Failed to parse request path parameter.

Fields

§param_name: Cow<'static, str>

Name of the parameter that failed to parse.

§source: Option<Box<dyn Error + Send + Sync + 'static>>

Underlying error that occurred while parsing the param.

§backtrace: Backtrace

Stack trace indicating where the error occurred.

§

InvalidRequestQueryParam

Failed to parse request query param.

Fields

§param_name: Cow<'static, str>

Name of the parameter that failed to parse.

§source: Option<Box<dyn Error + Send + Sync + 'static>>

Underlying error that occurred while parsing the param.

§backtrace: Backtrace

Stack trace indicating where the error occurred.

§

MissingRequestBody(Backtrace)

Missing required request body.

§

MissingRequestHeader(Cow<'static, str>, Backtrace)

Missing required request header.

§

MissingRequestParam(Cow<'static, str>, Backtrace)

Missing required request param.

§

Panic(String, Backtrace)

Request handler panicked.

§

ToJsonResponse

Failed to serialize response body to JSON.

Fields

§type_name: Cow<'static, str>

Name of the response body type that failed to serialize.

§source: Box<Error<Error>>

Underlying error that occurred while serializing the response body.

§backtrace: Backtrace

Stack trace indicating where the error occurred.

§

UnexpectedContentType(String, Backtrace)

Unexpected request Content-Type.

§

UnexpectedOperationId(String, Backtrace)

Unexpected operation ID.

Implementations§

Source§

impl EventError

Source

pub fn backtrace(&self) -> Option<&_Backtrace>

Return the backtrace associated with the error, if known.

Source

pub fn name(&self) -> &str

Return the name of the error variant (e.g., InvalidBodyBase64).

Trait Implementations§

Source§

impl Debug for EventError

Source§

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

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

impl Display for EventError

Source§

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

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

impl Error for EventError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<&EventError> for HttpResponse

Source§

fn from(err: &EventError) -> HttpResponse

Build a client-facing HttpResponse appropriate for the error that occurred.

This function will set the appropriate HTTP status code (400 or 500) depending on whether the error is internal (500) or caused by the client (400). For client errors, the response body contains a human-readable description of the error and the Content-Type response header is set to text/plain. For internal errors, no response body is returned to the client.

Source§

impl From<EventError> for HttpResponse

Source§

fn from(err: EventError) -> HttpResponse

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more