Skip to content

Commit

Permalink
Raising custom exception if an unknonw option is referenced (Issue #43)
Browse files Browse the repository at this point in the history
  • Loading branch information
thasso committed Jan 30, 2014
1 parent b9a1099 commit d59a606
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions jip/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,17 @@ def __str__(self):
return str(self.option)

def __getattr__(self, name):
# check that the option exists (Issue #43)
opt = self.node._tool.options[name]
if opt is None:
log.info("Option '%s' not found in %s",
name, self.node, exc_info=True)
raise ValidationError(
self.node,
"Option '%s' not found in node '%s'" % (
name, self.node
)
)
return OptionWrapper(
self.node, self.node._tool.options[name]
)
Expand Down

0 comments on commit d59a606

Please sign in to comment.