sqlalchemy-jsonapi icon indicating copy to clipboard operation
sqlalchemy-jsonapi copied to clipboard

Getting an AttributeError when using validates decorator with AssertionError

Open alexvermeulen opened this issue 9 years ago • 1 comments

When adding model field validation with sqlalchemy's @validates decorator as illustrated in the docs I get the error AttributeError: 'AssertionError' object has no attribute 'msg'. It seems sqlalchemy-jsonapi is trying to access the exception message through e.msg where it should be accessible through e directly. I'm assuming this change happened with Python 3?

alexvermeulen avatar Sep 12 '16 00:09 alexvermeulen

It's actually just bad code. Python 2 has e.message but neither Python 2 or 3 has a msg attribute. As I said in the PR, I think we can just raise the caught exception. It's kind of scary this doesn't get caught by the test coverage, which would seem to indicate our tests aren't very robust.

btw, I'm helping Colton get patches reviewed and landed. I just started helping out. Sorry this issue and patch have been sitting for awhile.

Anderycks avatar Feb 24 '17 16:02 Anderycks