Expand and clarify error messages for AnonymousTuple.
@@ -122,8 +122,9 @@ class AnonymousTuple(object):
def __getattr__(self, name):
if name not in self._name_to_index:
raise AttributeError(
- 'The tuple does not have a member "{}". Members (only first 10): {}'
- .format(name,
+ 'The tuple of length {:d} does not have named field "{!s}".'
+ 'Names (only first 10): {!s}'.format(
+ len(self._element_array), name,
list(self._name_to_index.keys())[:10]))
return self._element_array[self._name_to_index[name]]
