serpy icon indicating copy to clipboard operation
serpy copied to clipboard

Serpy does not catch Key and Attribute errors on MethodField

Open Cediddi opened this issue 5 years ago • 0 comments

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.

Cediddi avatar Jan 11 '20 12:01 Cediddi