Skip to content

Error when the error response is in bytes format #192

Open
@EmadMokhtar

Description

@EmadMokhtar

Overview

We are getting errors from the Druid APIs but it is in a bytes format b''. When the error response passed to the json.loads() it will crash. I think this happening after this PR #121.

Error Details

        except urllib.error.HTTPError as e:
            err = e.read()
            if e.code == 500:
                # has Druid returned an error?
                try:
                    err = json.loads(err)  # ERROR HAPPEN HERE
                except ValueError:
                    if HTML_ERROR.search(err):
                        err = HTML_ERROR.search(err).group(1)
                except (ValueError, AttributeError, KeyError):
                    pass
err = b'{"error":"Unknown exception","errorMessage":"Failure getting results for query[85d259df-c0ea-43c7-93d9-49e609b3b203] url[http://druid/druid/v2/] because of [org.jboss.netty.channel.ChannelException: Channel disconnected]","errorClass":"org.apache.druid.java.util.common.RE","host":null}'

versions

  • Druid version: 0.16.0
  • Python: 3.5.3
  • PyDruid: 0.5.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions