jamesremuscat / pyze

Unofficial Python client and API for Renault ZE
MIT License
111 stars 29 forks source link

Replace RuntimeErrors in Gigya with appropiate (sub)classed Errors #82

Open mfonville opened 4 years ago

mfonville commented 4 years ago

At the moment, anything that goes wrong during the Gigya login process throws the same generic RuntimeError. This makes it for users of the API impossible to detect (and catch) if e.g. just login username/password supplied by the user is wrong, or if there is something else broken in e.g. a dependency.

Could we please change the error types, they could be a subclass of RuntimeError for more generic usage and backwards compatibility? A good example of exceptions usage is the Requests-library: https://requests.readthedocs.io/en/master/_modules/requests/exceptions/

My proposal would be a new exception class: GigyaException(RuntimeError) Something similar could also be done for Kamereon. (or a PyZEException, but imho it would be appropriate to have them separate)

mfonville commented 4 years ago

@jamesremuscat I would like to have some feedback how you feel about this, before I would make a PR :-)

epenet commented 3 years ago

Hi @jamesremuscat Do you have a view on this?