ENH: Improve error message on bad return.

This commit is contained in:
Scott Sanderson
2017-06-07 17:07:19 -04:00
parent 709735de51
commit 09cc54e08a
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -591,8 +591,12 @@ class LabelArray(ndarray):
if not isinstance(ret, otypes):
raise TypeError(
"Expected f() to return a string. Got %s." % (
type(ret).__name__
"LabelArray.map expected function {f} to return a string"
" or None, but got {type} instead.\n"
"Value was {value}.".format(
f=f.__name__,
type=type(ret).__name__,
value=ret,
)
)