druid-io / pydruid

A Python connector for Druid
Other
506 stars 194 forks source link

Don't throw away error messages from Druid #160

Closed legoscia closed 5 years ago

legoscia commented 5 years ago

In certain cases, Druid will return an error message in JSON format in the body of the HTTP response. However, PyDruid would attempt to parse the HTTP reason phrase as JSON instead, which wouldn't succeed as it is something like "Bad Request" and "Server Error". Fix this by parsing the response body instead.

Also do the same thing for error code 400 ("bad request"), not just

  1. For "bad request" errors, there is usually a clue as to what's wrong with the query in the error message, so it's worth displaying the error message instead of discarding it.
legoscia commented 5 years ago

Hm, that didn't work very well in Python 2. Is there a clever way to work around the differences?...

legoscia commented 5 years ago

Closing in favour of #161.