Port the tests for error handling.

https://github.com/ariya/phantomjs/issues/12439