better error message when an operation of the API fails