nodet / dowml

A library and command line client to use Decision Optimization on IBM Watson Machine Learning (WML). NOT SUPPORTED BY IBM.
Apache License 2.0
3 stars 0 forks source link

Review the code for exceptions #46

Closed nodet closed 2 years ago

nodet commented 2 years ago

https://julien.danjou.info/python-exceptions-guide/

nodet commented 2 years ago

According to that guide, dowml should systematically catch any exception coming from a library it uses and turn them into its own exceptions using

    raise MyOwnException(...) from ex

Should we systematically catch any exception coming from ibm-watson-machine-learning and re-raise our own without even thinking about it? Considering that dowml would have nothing to add to the original exception, and given how much work this entails, I really don't think there is any benefit in this. This may change in the future, of course...

The example of Tooz is interesting... Indeed, when implementing some code that uses different libraries to do similar work depending on some conditions, it makes perfect sense that the user's code should not have to care about what exactly these conditions were, and what library was used underneath.