Log errors. If you call an API and it returns an error code. Log the error code. Ideally at the verbose level also log the parameters to the API but in any case log the error. This means for every API that you call you must first check for an error. I wasted half a day of my life troubleshooting code that failed to follow this simple rule.