Skip to content

Result Error logging at the end of execution #215

@lxwbr

Description

@lxwbr

I am using the latest master (ebc5474) and structure my project according to this example: https://github.com/awslabs/aws-lambda-rust-runtime/blob/master/lambda/examples/hello-without-macro.rs

What I ran into is that if having e.g. a DynamoDB call like this:

let result = dynamodb_client.update_item(update_item_input).await?;

which is returning a Result<UpdateItemOutput, RusotoError<UpdateItemError>> and RusotoError implementing the std::error::Error, I wouldn't see the error in CloudWatch logs. The lambda would still fail, but I wouldn't be able to have a look at what exactly failed.

Is there a way that I could have a general match on the async fn func(event: Value) -> Result<Value, Error> at the end of the execution of the lambda and be able to log the error via println?

Coming from Typescript, I would put a try catch around my whole function and log the error. Basically I am looking for something similar here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions