[][src]Crate lambda_runtime_errors

The Lambda runtime errors crate defines the LambdaErrorExt trait that can be used by libriaries to return errors compatible with the AWS Lambda Rust runtime.

This crate also exports the lambda_runtime_errors_derive crate to derive the LambdaErrorExt trait.

use lambda_runtime_errors::*;

// the generated error_type() method returns "crate::LambdaError"
#[derive(LambdaErrorExt)]
struct LambdaError;

Structs

HandlerError

The HandlerError struct can be use to abstract any Err of the handler method Result. The HandlerError object can be generated From any object that supports Display, Send, Sync, and Debug. This allows handler functions to return any error using the ?syntax. For examplelet _age_num: u8 = e.age.parse()?;will return the::Err` from the handler function.

Traits

LambdaErrorExt

The LambdaErrorExt trait defines the error_type() method used by the AWS Lambda runtime client to generate ErrorResponse objects. The value returned by the error_type() method is used to populate the errorType field in the Lambda response. This crate includes an implementation of this trait for most errors in the standard library. By default, error return their type name.

LambdaResultExt

Result type extension for AWS that makes it easy to generate a HandlerError object or a Compat<Error> from the failure crate using an existing result. This trait should be imported from the lambda_runtime_core or lambda_runtime crates.