Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch validation errors during patch serialization #682

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kiptoomm
Copy link

@kiptoomm kiptoomm commented Feb 6, 2018

  • Adds a block to catch validation exceptions that occur when PATCHing a resource

tests/helpers.py Outdated
@@ -118,6 +119,28 @@ def deserialize_many(self, *args, **kw):
"""Immediately raises a :exc:`DeserializationException`."""
raise DeserializationException

class raise_s_validation_error(DefaultSerializer):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

- we want to force triggering of validation exceptions during
serialiation
- add unit test to verify that validation exception is raised on patch
- a validation exception should be raised when a validation error occurs
during serialization
- create a serializer class that automatically throws the validation
exception
- uses marshmallow's ValidationError exception, but in theory any
exception could be used to force the check in order to pass them
through to the flask-restless validations exceptions handler and
thus have it return meaningful errors to client

fix spacing issue caught by houndci
@kiptoomm kiptoomm force-pushed the debug_validate_patch branch from 287b085 to b3788d2 Compare February 6, 2018 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants