Added tests for error handling.