Skip to content

splunklib.binding.HTTPlib.request improper exception handling. #599

Open
@joroger

Description

@joroger

Each time an HTTP request is made, splunklib checks the if the response code 400 or greater (line 1345).
If the response code is 400 <= then an exception is raised by calling the HTTPError(). HTTPError has no return, so a generic Python error message of BaseException.with_traceback() takes exactly one argument (0 given)
Testing has shown that replacing "raise HTTPError(response)" with "raise None" results in the same outcome.

Possibly removing the "raise" and just call the function on its own will fix this, but I'm unsure what the intended effect was suppose to be.

CODE SNIPPET

    while True:
        try:
            response = self.handler(url, message, **kwargs)
            break
        except Exception:
            if self.retries <= 0:
                raise
            else:
                time.sleep(self.retryDelay)
                self.retries -= 1
    response = record(response)
    if 400 <= response.status:
        raise HTTPError(response)

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