Add a test for error handling