I have fixed the error messages in assert_list().

Review Request #2370 - Created June 16, 2015 and submitted

Information
Sara Solano
pants
sarasolano/assert_list_exceptions
1673
75e802b...
Reviewers
pants-reviews
dturner-tw, zundel

Add a key field to the error messages in assert_list() function in validation.py

When calling the assert_list() function in validation.py, the user didn't have access to the keyword in which the specific error happened, thus making it harder to debug. I have added a key argument param to this function and to the error message to make the message more specific.

current error message:

Exception message: Expected an object of acceptable type (<type 'list'>, <class 'twitter.common.dirutil.fileset.Fileset'>, <class 'pants.backend.core.wrapped_globs.FilesetWithSpec'>, <class 'twitter.common.collections.orderedset.OrderedSet'>, <type 'set'>, <type 'tuple'>), received examples/src/python/hello/greet instead

expected modified error message:

Exception message: In key 'sources': Expected an object of acceptable type (<type 'list'>, <class 'twitter.common.dirutil.fileset.Fileset'>, <class 'pants.backend.core.wrapped_globs.FilesetWithSpec'>, <class 'twitter.common.collections.orderedset.OrderedSet'>, <type 'set'>, <type 'tuple'>), received examples/src/python/hello/greet instead

(the key argument has been added to the error message)

Error encountered in issue #642

Issues

  • 0
  • 5
  • 0
  • 5
Description From Last Updated
Sara Solano
Sara Solano
Eric Ayers
Nick Howard (Twitter)
Sara Solano
Eric Ayers
Sara Solano
Eric Ayers
Eric Ayers
Nick Howard (Twitter)
Sara Solano
Eric Ayers
Sara Solano
Review request changed

Status: Closed (submitted)

Loading...