Skip to content

Commit

Permalink
Merge pull request #73 from BSVogler/fix-key-error
Browse files Browse the repository at this point in the history
Return attribute error when using attribute
  • Loading branch information
ruscoder authored Jun 23, 2021
2 parents 8b2f544 + b00ced5 commit 4296920
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fhirpy/base/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ def __setitem__(self, key, value):
super(AbstractResource, self).__setitem__(key, value)

def __getitem__(self, key):
return super(AbstractResource, self).__getitem__(key)
try:
return super(AbstractResource, self).__getitem__(key)
except KeyError as e:
raise AttributeError from e

def __getattr__(self, key):
return self[key]
Expand Down

0 comments on commit 4296920

Please sign in to comment.