Add test for API errors