Skip to content

Commit

Permalink
Clearer exception messages when _BaseCell.get_child or Node.lookup_st…
Browse files Browse the repository at this point in the history
…r are passed bad parameters
  • Loading branch information
Erik Allik committed Sep 26, 2013
1 parent 757f67f commit 7c6b2a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spinoff/actor/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _child_gone(self, child):

def get_child(self, name):
if not (name and isinstance(name, str)):
raise TypeError("get_child takes a non-emtpy string") # pragma: no cover
raise TypeError("get_child takes a non-emtpy string not %r" % (name,)) # pragma: no cover
return self._children.get(name, None)

def lookup_cell(self, uri):
Expand Down
2 changes: 2 additions & 0 deletions spinoff/actor/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def __init__(self, nid=None, enable_remoting=False, enable_relay=False, hub_kwar
)

def lookup_str(self, addr):
if not isinstance(addr, str):
raise TypeError("%s.lookup_str expects a str" % type(self).__name__) # pragma: no cover
return self.lookup(Uri.parse(addr))

def lookup(self, uri):
Expand Down

0 comments on commit 7c6b2a7

Please sign in to comment.