colander icon indicating copy to clipboard operation
colander copied to clipboard

Exception Hierarchies

Open swooster-submitnet opened this issue 10 years ago • 1 comments

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?

swooster-submitnet avatar Nov 12 '13 23:11 swooster-submitnet

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.

tseaver avatar Dec 20 '13 20:12 tseaver