-
-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better exceptions #487
Better exceptions #487
Conversation
Codecov Report
@@ Coverage Diff @@
## master #487 +/- ##
=======================================
Coverage 90.66% 90.67%
=======================================
Files 28 28
Lines 2615 2616 +1
=======================================
+ Hits 2371 2372 +1
Misses 244 244
Continue to review full report at Codecov.
|
Will close and re-open to see if we get an auto docs build! |
It worked! Docs render properly: https://tablib--487.org.readthedocs.build/en/487/api/#module-tablib.exceptions Do we want to use the old exception doc descriptions as exception text, or use these new ones? |
The new descriptions are better, IMHO, but they could be even better. E.g. |
Actually not new, I've only changed the strings to docstrings ;) Maybe something like "You're trying to add something that doesn't quite look right: Only Datasets can be added to a DataBook"? There were some missing exceptions in docs:
|
@claudep I totally agree. Do you mean in code, where they're raised, or adding the message to exception? Something like:
|
No, I was only referring to the docstring. In the code, the message should be the best possible in the place where it is raised. |
E.g. The size of the column or row doesn't fit the table dimensions.? Also, do you think it would be worth adding the previous snippet to |
I'm not sure, if you find in the code examples where either the exception name or the exception message is not clear enough, then let's fix that in the code. |
Of all the custom exceptions, only some A base exception is always a plus when adding a library as a dependency. Happy to contribute to this revision. PS: btw, I just found that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good.
It's best practise for libraries to have a common parent class for its custom exceptions so that they all can be easily catched.
This PR also refines the built-in exceptions inheritance and adds autodoc for the exceptions module.