iron-io/iron_core_python

error messages get swallowed

Opened this issue · 0 comments

r = self._doRequest(url, method, body, headers)
retry_http_codes = [503, 504]
if r.status_code in retry_http_codes and retry:
tries = 5
delay = .5
backoff = 2
while r.status_code in retry_http_codes and tries > 0:
tries -= 1
time.sleep(delay)
delay *= backoff
r = self._doRequest(url, method, body, headers)
r.raise_for_status()

The actual error message is in response.text and can't be accessed after the raise_for_status anymore. It's hard to know on application level what went wrong if the error is just "400 bad request". It would be good if the actual error message would be part of the exception message.

After hacking the library I found out that I actually got the error message {"msg":"Message must be no more than 64k"} from ironmq. I was spending have the day searching why my request is not working.