Skip to content

Commit

Permalink
utils: Fixed JSON error handling from requets
Browse files Browse the repository at this point in the history
This will be fixed in requests as well, see
psf/requests#6036

Fixes WEBLATE-8XX
  • Loading branch information
nijel committed Feb 24, 2022
1 parent 41641ae commit 817651a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion weblate/utils/errors.py
Expand Up @@ -68,7 +68,9 @@ def report_error(

error = sys.exc_info()[1]

if isinstance(error, JSONDecodeError) and not extra_log:
# Include JSON document if available. It might be missing
# when the error is raised from requests.
if isinstance(error, JSONDecodeError) and not extra_log and hasattr(error, "doc"):
extra_log = repr(error.doc)

log("%s: %s: %s", cause, error.__class__.__name__, error)
Expand Down

0 comments on commit 817651a

Please sign in to comment.