aws-lambda-dotnet: Exception handling does not work for .Net Core 2.0 for Lambda and Step Functions
According to this example in “AWS Lambda Developer Guide”, custom exception can be caught by Step Function State’s Catch clause using ErrorEquals with the custom exception type name.
This works for Node.js, .Net Core 1.0. But it does not work for .Net Core 2.0.
With .Net Core 2.0, it gets the following output on the step that throws the custom exception:
{
"Error": "Lambda.Unknown",
"Cause": "The cause could not be determined because Lambda did not return an error type."
}
While with .Net Core 1.0, it gets the expected one as below:
{
"Error": "CustomError",
"Cause": "{\n \"errorType\": \"CustomError\",\n \"errorMessage\": \"This is a custom error!\",\n \"stackTrace\": [\n \"at FailFunctionNet.Function.FunctionHandler(String input, ILambdaContext context)\",\n \"at lambda_method(Closure , Stream , Stream , ContextInfo )\"\n ]\n}\n"
}
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 21 (6 by maintainers)
The workaround also worked for me. It would be nice if this, and
asyncnot returningAggregateExceptionwould be fixed. I’m currently manually unwrappingAggregateExceptionbefore throwing from a synchronous entry point. It’s a bit silly.