Better error message when (data) node hasn't been declared #2

Open
opened 2024-10-23 16:46:43 +02:00 by hjp · 0 comments
Owner

Currently it looks like this:

2024-10-23 16:40:55,819 INFO procrusql.check 58 | Checking __rule_132
Traceback (most recent call last):
  File "/home/hjp/venv/usradm/bin/procrusql-fit", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/hjp/venv/usradm/lib/python3.12/site-packages/procrusql/__init__.py", line 373, in main
    fit(db, rules)
  File "/home/hjp/venv/usradm/lib/python3.12/site-packages/procrusql/__init__.py", line 326, in fit
    w.check()
  File "/home/hjp/venv/usradm/lib/python3.12/site-packages/procrusql/__init__.py", line 71, in check
    key_values = [v.resolve() if isinstance(v, Ref) else v for v in self.key.values()]
                  ^^^^^^^^^^^
  File "/home/hjp/venv/usradm/lib/python3.12/site-packages/procrusql/__init__.py", line 309, in resolve
    if not datanode.ok:
           ^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'ok'

which isn't very helpful. Neither the autogenerated rule name __rule_132 nor the stack trace contain the name of the missing node.

Currently it looks like this: ``` 2024-10-23 16:40:55,819 INFO procrusql.check 58 | Checking __rule_132 Traceback (most recent call last): File "/home/hjp/venv/usradm/bin/procrusql-fit", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/hjp/venv/usradm/lib/python3.12/site-packages/procrusql/__init__.py", line 373, in main fit(db, rules) File "/home/hjp/venv/usradm/lib/python3.12/site-packages/procrusql/__init__.py", line 326, in fit w.check() File "/home/hjp/venv/usradm/lib/python3.12/site-packages/procrusql/__init__.py", line 71, in check key_values = [v.resolve() if isinstance(v, Ref) else v for v in self.key.values()] ^^^^^^^^^^^ File "/home/hjp/venv/usradm/lib/python3.12/site-packages/procrusql/__init__.py", line 309, in resolve if not datanode.ok: ^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'ok' ``` which isn't very helpful. Neither the autogenerated rule name `__rule_132` nor the stack trace contain the name of the missing node.
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hjp/procrusql#2
No description provided.