Define own hierarchy of exceptions? #248
Labels
Design
Ideas, suggestions, musings about design questions
Enhancement
Not a bug, but increases or improves in value, quality, desirability, or attractiveness
Question
Unclear or open issue subject for debate
Release_3.x.y
Only for the major release 3
Uh oh!
There was an error while loading. Please reload this page.
Situation
Currently, our code catches an invalid version and raise an exception. This is good. However, the exceptions are usually builtin exceptions like
TypeError
,ValueError
, orAttributeError
.This could make it likely, that an semver exceptions are "hidden". It cannot explicitly be checked that a
TypeError
is coming from semver and not from another, unrelated third party library.Proposal
This part could be solved by introducing our own hierarchy of exceptions like so:
The nice thing about this approach is, any old code would still work (as
InvalidVersionError
is derived fromValueError
).@python-semver/reviewers would that be an option?
The text was updated successfully, but these errors were encountered: