Adding test for error handling