Refactor exceptions in build_file.py and build_file_parser.py to derive from a common baseclass and eliminate throwing IOError. Catch errors from parse errors in the BUILD file and format context around the exception.

Review Request #954 - Created Aug. 28, 2014 and submitted

Information
Eric Ayers
pants
zundel/refactor-build-file-exceptions
537
5530f74...
Reviewers
pants-reviews
jsirois, patricklaw

Followon to https://rbcommons.com/s/twitter/r/929/

Refactor exceptions in build_file.py and build_file_parser.py to derive from a common baseclass and eliminate throwing IOError.

Revive error message that prints out alternatives to an incorrect build target.

Also, Catch exceptions from parse errors in the BUILD file and print some formatted context around the line of the file that failed.

Exception message: Error parsing /Users/zundel/Src/Pants/examples/src/java/com/pants/examples/hello/greet/BUILD:
4: java_library(name = 'greet',
5: dependencies = [], # A more realistic example would depend on other libs,
6: # but this "hello world" is pretty simple.
7: sources = globs('.java' && foo),
^ SyntaxError: invalid syntax (<string>, line 7)

8:   provides = artifact(org='com.pants.examples',
9:                     name='hello-greet',

10: repo='build-support/ivy:public',),
11: )

ci passed at https://travis-ci.org/pantsbuild/pants/builds/33756154

Issues

  • 0
  • 6
  • 0
  • 6
Description From Last Updated
Patrick Lawson
Eric Ayers
Patrick Lawson
John Sirois
Eric Ayers
John Sirois
Eric Ayers
Review request changed

Status: Closed (submitted)

Change Summary:

commit b1545f2
Loading...