Pylons / colander

A serialization/deserialization/validation library for strings, mappings and lists.
https://docs.pylonsproject.org/projects/colander/en/latest/
Other
447 stars 145 forks source link

Exception Hierarchies #153

Open swooster-submitnet opened 10 years ago

swooster-submitnet commented 10 years ago

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?

tseaver commented 10 years ago

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.