Adding test for error and making it pass