colander
colander copied to clipboard
Exception Hierarchies
I'd like to use Colander to validate input into an API, and it'd be useful to differentiate errors without resorting to brittle things like inspecting the error message. Colander appears to support throwing subclasses of Invalid
, but I don't see a straightforward way to write a wrapper library that (for example) throws different exceptions for missing values and unknown ones without abusing Colander internals.
Assuming that my managers are fine with me contributing to the Pylons Project, and that I can write a change that Colander's maintainers approve of, is this a feature that fits with plans for Colander?
As long as the new classes derive from Invalid (so that code which does 'except Invalid:' still works), I don't see any reason why such a change would be a problem.