-
Notifications
You must be signed in to change notification settings - Fork 41
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
Turn AnnifException into an abstract base class and fix message prefix behavior #320
Conversation
Codecov Report
@@ Coverage Diff @@
## master #320 +/- ##
==========================================
+ Coverage 99.38% 99.45% +0.06%
==========================================
Files 55 55
Lines 2920 2917 -3
==========================================
- Hits 2902 2901 -1
+ Misses 18 16 -2
Continue to review full report at Codecov.
|
The abstractness isn't actually working though. It's still possible to instantiate AnnifException when defined this way. Apparently inheriting from ClickException somehow cancels the abstractness of the class... |
Something weird is happening here, I posted a question on StackOverflow because I can't understand it. |
This SO discussion seems to be related. |
Thanks @juhoinkinen , I wonder why I didn't find that discussion myself. I answered my own SO question and will update this PR according to the workarounds provided in the earlier SO posts. |
…ce Exception subclasses cannot be made abstract using the abc module.
Almost forgot to add the tests I wrote. |
I realized that
AnnifException
isn't intended to be instantiated directly but doing so was still possible. This PR changes into an abstract base class, which cannot be instantiated.While performing the change, I noticed that the prefix mechanism used to generate error messages was broken. This PR fixes it as well.
Example error before the changes:
Example error after the changes: