Skip to content

Commit

Permalink
Catch errors when setting non-existent attributes on NcList items.
Browse files Browse the repository at this point in the history
  • Loading branch information
mischakolbe committed Nov 30, 2018
1 parent e2600b6 commit 8f0c67e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion node_calculator/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,13 @@ def __setattr__(self, name, value):

else:
for item in self._items:
_unravel_and_set_or_connect_a_to_b(NcNode(item, name), value)
current_node = NcNode(item, name)
try:
_unravel_and_set_or_connect_a_to_b(current_node, value)
except RuntimeError:
LOG.warn(
"Could not set %s to value %s. Maybe this attribute "
"doesn't exist on the node!", current_node, value)

def __getitem__(self, index):
"""Get stored item at given index.
Expand Down

0 comments on commit 8f0c67e

Please sign in to comment.