Add more verbose API error handling