Catch API request errors.