ClementJ18 / moddb

A Python scrapper to access ModDB mods, games and more as objects
https://moddb.readthedocs.io
MIT License
13 stars 8 forks source link

utils.py: Catch request's own JSONDecodeError exception in raise_for_status() #33

Closed Staudey closed 1 year ago

Staudey commented 1 year ago

The following might be incorrect due to my unfamiliarity with both Python and this library, but it allowed me to get it to work on Solus:

request has it's own alias for both simplejson and json decode errors

        except JSONDecodeError as e:
            # Catch JSON-related errors and raise as requests.JSONDecodeError
            # This aliases json.JSONDecodeError and simplejson.JSONDecodeError

Using it avoids uncaught errors disrupting the control flow on systems using simplejson (as the except clause doesn't catch simplejson exceptions in it's current form)

ClementJ18 commented 1 year ago

Seems like you're correct, thanks for the fix