Better error handling for unsuccessful responses