In patch_resource and post_collection we were excepting an AssertionError and then raising a custom ValidationError from the errors.py file. For example,
except AssertionError as e:
session.rollback()
raise ValidationError(e.msg)
The problem is that there is no msg attribute on the exception.
While I tried to change this to be ValidationError(e) instead, this raises a TypeError in the json.JSONEncoder since the AssertionError is not JSON serializable.
Thus the easiest option that also keeps our tests passing is to do it as such
except AssertionError as e:
session.rollback()
raise ValidationError(str(e))
In
patch_resource
andpost_collection
we were excepting an AssertionError and then raising a custom ValidationError from the errors.py file. For example,The problem is that there is no msg attribute on the exception.
While I tried to change this to be
ValidationError(e)
instead, this raises aTypeError
in thejson.JSONEncoder
since the AssertionError is not JSON serializable.Thus the easiest option that also keeps our tests passing is to do it as such