aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2018-11-24 17:17:10 +0100
committerGuido Günther <agx@sigxcpu.org>2018-11-24 17:17:10 +0100
commit4a8908ce6116e881258f0e9584be546f2087e525 (patch)
tree094c401309c653451129f4cc45500b222c1d9216
parentdacca59e1a968f79253dca901e212e868954fcff (diff)
Make it simple to print exception details
-rw-r--r--gbp/scripts/common/__init__.py6
-rw-r--r--gbp/scripts/import_dsc.py4
2 files changed, 9 insertions, 1 deletions
diff --git a/gbp/scripts/common/__init__.py b/gbp/scripts/common/__init__.py
index e49930e..023d2b8 100644
--- a/gbp/scripts/common/__init__.py
+++ b/gbp/scripts/common/__init__.py
@@ -18,6 +18,7 @@
import re
import os
+import traceback
from gbp.errors import GbpError
from gbp.deb import DebianPkgPolicy
from gbp.pkg import Archive
@@ -67,3 +68,8 @@ def get_component_tarballs(name, version, tarball, components):
if not os.path.exists(cname):
raise GbpError("Can not find component tarball %s" % cname)
return tarballs
+
+
+def debug_exc(options):
+ if options.verbose:
+ traceback.print_exc()
diff --git a/gbp/scripts/import_dsc.py b/gbp/scripts/import_dsc.py
index 8cd22c0..e7b89a6 100644
--- a/gbp/scripts/import_dsc.py
+++ b/gbp/scripts/import_dsc.py
@@ -35,7 +35,7 @@ from gbp.git.vfs import GitVfs
from gbp.config import (GbpOptionParserDebian, GbpOptionGroup,
no_upstream_branch_msg)
from gbp.errors import GbpError
-from gbp.scripts.common import ExitCodes
+from gbp.scripts.common import ExitCodes, debug_exc
from gbp.scripts.common import repo_setup
import gbp.log
@@ -534,9 +534,11 @@ def main(argv):
pass # command itself printed an error
except GitRepositoryError as msg:
gbp.log.err("Git command failed: %s" % msg)
+ debug_exc(options)
except GbpError as err:
if str(err):
gbp.log.err(err)
+ debug_exc(options)
except SkipImport:
skipped = True
ret = 0