Skip to content

Caught hasattr() error re-raised in DAObject.__getattr__ #968

Description

@jpagh

Edited:

When there's some kind of error with a dunder method, docassemble doesn't raise the right error, making it hard to diagnose the issue, in this case a caught hasattr() error.

Reproduction

YAML:

---
objects:
  - test_obj: DAObject
---
mandatory: True
question: |
  Bug Reproduction — Stale `pending_error`
subquestion: |
  Step 1: ${ hasattr(test_obj, 'nonexistent') }
  Step 2: ${ test_obj.__custom__ }
---

Result:

Interview has an error. There was a reference to a variable 'test_obj.nonexistent'
that could not be looked up in the question file (for language 'en') or in any of
the files incorporated by reference into the question file.

Docassemble seeks a question for test_obj.nonexistent which was only ever checked via hasattr(). The actual expression is test_obj.__custom__.

Expected result:

An error about test_obj.__custom__, not the caught hasattr() error about a different variable.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions