clarkduvall / serpy

ridiculously fast object serialization
http://serpy.readthedocs.org/en/latest/
MIT License
960 stars 62 forks source link

Serpy does not catch Key and Attribute errors on MethodField #73

Open Cediddi opened 4 years ago

Cediddi commented 4 years ago

I think there should be a way to stop serialization of a MethodField. A simple approach would be catching the KeyError and AttributeError on MethodField serialization and decide if the exception should be supressed or raised. If the field is required exceptions should be propagated but if the field is optional exception should be supressed just like in other fields.

This is less of a feature request and more of a bugfix because of consistency of behavior is important.