specs/tests for API error handling