Skip to content

Commit

Permalink
Improve error handling in attribute access by adding a custom message…
Browse files Browse the repository at this point in the history
… for missing attributes
  • Loading branch information
clement-moulin-frier committed Jan 15, 2025
1 parent 73fe440 commit 303b7b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion vivarium/controllers/notebook_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ def __getattr__(self, item):
if item in self.config.param_names():
return getattr(self.config, item)
else:
return super().__getattr__(item)
try:
return super().__getattr__(item)
except AttributeError as e:
print(f"{self.__class__.__name__} has no attribute {item}")
raise

# TODO : Add a check to ensure that the attribute's value is authorized (according to params bounds)
def __setattr__(self, item, val):
Expand Down

0 comments on commit 303b7b5

Please sign in to comment.