postInvocationError method

Future<HttpClientResponse> postInvocationError (
  1. String requestId,
  2. InvocationError err
)

Post an invocation error to the AWS Lambda Runtime Interface. It takes in an InvocationError and the requestId. The requestId is used to map the error to the execution.

Implementation

Future<HttpClientResponse> postInvocationError(
    String requestId, InvocationError err) async {
  final request = await _client.postUrl(
    Uri.parse(
      'http://${runtimeApi}/${runtimeApiVersion}/runtime/invocation/$requestId/error',
    ),
  );
  request.add(
      utf8.encode(
          json.encode(err)
      )
  );

  return await request.close();
}