Expand description
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§
- Handler
Error - The
HandlerError
struct can be use to abstract anyErr
of the handler methodResult
. TheHandlerError
object can be generatedFrom
any object that supportsDisplay
,Send,
Sync, and
Debug. This allows handler functions to return any error using the
?syntax. For example
let _age_num: u8 = e.age.parse()?;will return the
::Err` from the handler function.
Traits§
- Lambda
Error Ext - The
LambdaErrorExt
trait defines theerror_type()
method used by the AWS Lambda runtime client to generateErrorResponse
objects. The value returned by theerror_type()
method is used to populate theerrorType
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. - Lambda
Result Ext Result
type extension for AWS that makes it easy to generate aHandlerError
object or aCompat<Error>
from the failure crate using an existing result. This trait should be imported from thelambda_runtime_core
orlambda_runtime
crates.