Make AttributeErrors
on erhQL objects as helpful as possible
#2137
Labels
AttributeErrors
on erhQL objects as helpful as possible
#2137
When a user tries to access an non-existent attribute on an ehrQL object, we should try to make the error as helpful as possible.
There are (at least) two distinct cases here:
1. Typoing the name of an attribute which does exist on the object
Fortunately Python now handles this pretty nicely out-of-the-box and offers suggestions e.g.
2. Using an attribute which doesn't exist on this object but does on others
Examples might be calling
first_for_patient()
on a un-sorted frame, or callingsum_for_patient()
on a non-numeric series.We ought to be able to spot such errors and generate a more helpful error message.
Extracted from #505
The text was updated successfully, but these errors were encountered: