Skip to content

Commit b863fce

Browse files
Tree Contributorcopybara-github
authored andcommitted
Improve error message.
PiperOrigin-RevId: 430504390
1 parent b452e5c commit b863fce

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tree/sequence.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ def _sequence_like(instance, args):
9090
instance_type = type(instance.__wrapped__)
9191
else:
9292
instance_type = type(instance)
93-
return instance_type(*args)
93+
try:
94+
return instance_type(*args)
95+
except Exception as e:
96+
raise TypeError(
97+
f"Couldn't traverse {instance!r} with arguments {args}") from e
9498
elif isinstance(instance, ObjectProxy):
9599
# For object proxies, first create the underlying type and then re-wrap it
96100
# in the proxy type.

0 commit comments

Comments
 (0)