Adds a test for exception handling.
- Fixed handling to be approximately the same as Node (previous commit).