Skip to content

Commit 4be716d

Browse files
committed
better error message when incorrect data is passed to Selector "text" argument
1 parent c9901d2 commit 4be716d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

parsel/selector.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ def __init__(self, text=None, type=None, namespaces=None, root=None,
189189

190190
if text is not None:
191191
if not isinstance(text, six.text_type):
192-
raise TypeError("text argument should be of type %s" % six.text_type)
192+
msg = "text argument should be of type %s, got %s" % (
193+
six.text_type, text.__class__)
194+
raise TypeError(msg)
193195
root = self._get_root(text, base_url)
194196
elif root is None:
195197
raise ValueError("Selector needs either text or root argument")

0 commit comments

Comments
 (0)