Skip to content

Commit 7c6b2a7

Browse files
author
Erik Allik
committed
Clearer exception messages when _BaseCell.get_child or Node.lookup_str are passed bad parameters
1 parent 757f67f commit 7c6b2a7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

spinoff/actor/cell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def _child_gone(self, child):
8888

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

9494
def lookup_cell(self, uri):

spinoff/actor/node.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ def __init__(self, nid=None, enable_remoting=False, enable_relay=False, hub_kwar
3434
)
3535

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

3941
def lookup(self, uri):

0 commit comments

Comments
 (0)