post_lambda_error: Post an error to an endpoint with the format expected by AWS...

View source: R/error-handling.R

post_lambda_errorR Documentation

Post an error to an endpoint with the format expected by AWS Lambda

Description

According to the AWS Lambda Developer Guide an error posted to the initialisation or invocation error endpoints must be of content type application/vnd.aws.lambda.error+json and of the format:

{
  "errorMessage": "...",
  "errorType": "...",
  "stackTrace": [],
}

Here the errorMessage and errorType are strings, with the stackTrace a list of strings.

This function accepts an error as caught by tryCatch and posts it to the given endpoint, ensuring that the correct formatting is adhered to. This function does not stop the runtime as in the case of invocation errors it's desirable to continue.

The stacktrace is not currently reported. This functionality is yet to be implemented. See the GitHub issue for more details.

Usage

post_lambda_error(e, endpoint)

Arguments

e

an error as caught by tryCatch

endpoint

where to POST the error


lambdr documentation built on Nov. 25, 2023, 5:08 p.m.