summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Collins <rbtcollins@hp.com>2014-03-17 09:46:58 +1300
committerRobert Collins <rbtcollins@hp.com>2014-06-28 19:40:15 +1200
commitfa17f42d7d195dab77c042ac4881ac63bfb638f3 (patch)
treedf981cf021cc6ae228d86ccdc87dd62339b48951
parentd815366577a7dbb7a8dab66ab105e2803af4c007 (diff)
downloadpbr-fa17f42d7d195dab77c042ac4881ac63bfb638f3.tar.gz
Allow examining parsing exceptions.
Having to put breakpoints in pbr to diagnose issues is bad for dealing with reports from users. Change-Id: Ifecf4c4e4bb5955e0e5feb4bf5b5b85150b08ebe
-rw-r--r--pbr/core.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/pbr/core.py b/pbr/core.py
index 0aff652..0f4b94a 100644
--- a/pbr/core.py
+++ b/pbr/core.py
@@ -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))