Skip to content

Commit

Permalink
Add some extra debug info when reading file contents fails
Browse files Browse the repository at this point in the history
In response to #31

(To use the "as" syntax, changed run_py_tests.sh to use python2.7)
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=98748484
  • Loading branch information
joeltine authored and concavelenz committed Jul 22, 2015
1 parent 51077de commit c0d77a5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions closure/bin/build/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,13 @@ def GetFileContents(path):
IOError: An error occurred opening or reading the file.
"""
fileobj = open(path)
fileobj = None
try:
fileobj = open(path)
return fileobj.read()
except IOError as error:
raise IOError('An error occurred opening or reading the file: %s. %s'
% (path, error))
finally:
fileobj.close()
if fileobj is not None:
fileobj.close()

0 comments on commit c0d77a5

Please sign in to comment.