Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
joroger opened this issue Feb 2, 2025 · 0 comments
Open

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

joroger opened this issue Feb 2, 2025 · 0 comments

Comments

@joroger
Copy link

joroger commented Feb 2, 2025

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant