Skip to content

Getting an AttributeError when using validates decorator with AssertionError #28

Open

Description

@alexvermeulen

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?

Activity

  1. changed the title [-]AttributeError when using validates decorator with AssertionError[/-] [+]Getting an AttributeError when using validates decorator with AssertionError[/+] on Sep 12, 2016
  2. added 3 commits that reference this issue on Sep 12, 2016
    394636c
    6ef1542
    d62dc25
  3. Anderycks commented on Feb 24, 2017

    @Anderycks
    Collaborator

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions