sqlalchemy-jsonapi
sqlalchemy-jsonapi copied to clipboard
Getting an AttributeError when using validates decorator with AssertionError
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?
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.