Add lots more tests for error handling