When I do:
try:
Licensing().parse("MIT AND OR 0BSD")
except ExpressionError:
# Handle this
pass
The exception is not handled because a ParseError was raised instead. This isn't unexpected per se, because the docstring says as much, but I cannot see the difference between the two errors as a consumer of the library. I've rewritten my code to put except (ExpressionError, ParseError): everywhere, but it seems a little unnecessary to me.
Is it possible to make ExpressionError a subclass of ParseError? Or is it possible to consistently raise ExpressionErrors instead?
When I do:
The exception is not handled because a ParseError was raised instead. This isn't unexpected per se, because the docstring says as much, but I cannot see the difference between the two errors as a consumer of the library. I've rewritten my code to put
except (ExpressionError, ParseError):everywhere, but it seems a little unnecessary to me.Is it possible to make ExpressionError a subclass of ParseError? Or is it possible to consistently raise ExpressionErrors instead?