Useful package!
But it seems that it will always raise a generic Exception. Is there a reason not to raise either TypeError or a custom exception?
My use case is unit tests -- I want to confirm that my code throws type_enforced exceptions as appropriate, and not any other Exceptions I'm not aware of.
IMO the best choice would be a subclass of TypeError -- that way calling code can handle TypeError without knowing anything about type_enforced. But it is still possible to distinguish errors raised by Enforcer from those elsewhere in the code.
Useful package! But it seems that it will always raise a generic
Exception
. Is there a reason not to raise eitherTypeError
or a custom exception?My use case is unit tests -- I want to confirm that my code throws
type_enforced
exceptions as appropriate, and not any other Exceptions I'm not aware of.IMO the best choice would be a subclass of TypeError -- that way calling code can handle TypeError without knowing anything about type_enforced. But it is still possible to distinguish errors raised by Enforcer from those elsewhere in the code.
[happy to submit a PR for this if desired]