Consider a Step Function with a .net Lambda in it.
If the lambda throws an exception which contains a new line in the message, the Step Function does not recognise the type properly and instead reports:
Error
Lambda.Unknown
Cause
The cause could not be determined because Lambda did not return an error type.
The simplest repro is to create a .net lambda, and immediately throw an ArgumentNullException.
For our custom exceptions, I've been able to enforce no newlines. But for built in exceptions, this is a pain. Also, creating a custom exception and passing in the troublesome Exception as its inner exception still doesn't work.
I've had to resort to creating an exception that exposes the text of the original exception (removing newlines) so at least I can get the message out. However, because the Type of this exception is always the same, I lose the lovely branching available in the Step Functions depending on the type.
Note: I also think having double quotes in the message also messes things up.
Any ideas? I believe this is a bug in AWS and ideally I should be able to throw any exception and the Step Function would report it correctly.