Allow examining parsing exceptions.

Having to put breakpoints in pbr to diagnose issues is bad for dealing
with reports from users.

Change-Id: Ifecf4c4e4bb5955e0e5feb4bf5b5b85150b08ebe
This commit is contained in:
Robert Collins 2014-03-17 09:46:58 +13:00
parent d815366577
commit fa17f42d7d
1 changed files with 5 additions and 0 deletions

View File

@ -40,6 +40,7 @@
from distutils import core
from distutils import errors
import logging
import os
import sys
import warnings
@ -103,6 +104,10 @@ def pbr(dist, attr, value):
attrs = util.cfg_to_args(path)
except Exception:
e = sys.exc_info()[1]
# NB: This will output to the console if no explicit logging has
# been setup - but thats fine, this is a fatal distutils error, so
# being pretty isn't the #1 goal.. being diagnosable is.
logging.exception('Error parsing')
raise errors.DistutilsSetupError(
'Error parsing %s: %s: %s' % (path, e.__class__.__name__, e))