Skip to content

Commit

Permalink
Partial backport of #3469 (agent side only) to b0.72 (#3492)
Browse files Browse the repository at this point in the history
Replace `requests.exceptions.JSONDecodeError' by generic `Exception'.

See #3469 for some details. The upstream issue is

   psf/requests#5794

and the PR is

   psf/requests#5856

but we are running older versions of `requests' in various places.
  • Loading branch information
ndokos authored Jul 11, 2023
1 parent b5f8011 commit f8fb65d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/pbench/cli/agent/commands/results/move.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import List

import click
import requests

from pbench.agent.base import BaseCommand
from pbench.agent.results import CopyResultTb, MakeResultTb
Expand Down Expand Up @@ -111,7 +110,7 @@ def execute(self, single_threaded: bool, delete: bool = True) -> int:
if not res.ok:
try:
msg = res.json()["message"]
except requests.exceptions.JSONDecodeError:
except Exception:
msg = res.text if res.text else res.reason
raise CopyResultTb.FileUploadError(msg)
except Exception as exc:
Expand Down
3 changes: 1 addition & 2 deletions lib/pbench/cli/agent/commands/results/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import List

import click
import requests

from pbench.agent.base import BaseCommand
from pbench.agent.results import CopyResultTb
Expand Down Expand Up @@ -36,7 +35,7 @@ def execute(self) -> int:

try:
msg = res.json()["message"]
except requests.exceptions.JSONDecodeError:
except Exception:
msg = res.text if res.text else res.reason

# dup or other unexpected but non-error status
Expand Down

0 comments on commit f8fb65d

Please sign in to comment.