ColtonProvias / sqlalchemy-jsonapi

JSONAPI implementation for use with SQLAlchemy
MIT License
70 stars 27 forks source link

Fix fetching of AssertionError message for Python 3 #29

Closed alexvermeulen closed 7 years ago

alexvermeulen commented 8 years ago

Exceptions in Python 3 no longer contain a msg attribute. Instead the exception message is accessible from the exception object directly.

In order to maintain Python 2 support, attempt to fetch the message from e.msg and use str(e) as a default if the attribute does not exist.

I was going to add a test for this but I saw all the existing tests are currently commented out. I figured you were likely doing some refactoring and hadn't gotten to the tests yet. Perhaps you are already fixing this issue as part of your work as well. Regardless, I thought I'd throw up a PR in case it is useful to you.

Fixes #28

Anderycks commented 7 years ago

Going to close this since it's not the right approach and there hasn't been any activity. We have issue #28 to remind us of the bug. Please feel free to reopen if you update the branch.