splunk / splunk/splunk-sdk-python
splunklib.binding.HTTPlib.request improper exception handling.
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 743
- Forks
- 387
- Merge moyen
- 42 min
- PR mergées (30 j)
- 4
Description
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)
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Start at splunklib.binding.HTTPlib.request around line 1345 and inspect the definition of HTTPError and the retry loop. Confirm the intended behavior for responses with status 400 or greater, then add or update coverage to verify that the intended exception is raised without the generic BaseException error.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- api
- Type d'issue
- Bug
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100