Error management for the API calls.