summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-01-08 16:16:58 +0200
committerLars Wirzenius <liw@liw.fi>2017-01-08 16:16:58 +0200
commit252a5548fa8d7d90c736b27d8804ddabb0bad469 (patch)
tree8603f5eb323d7a0754ec40c6edbbe1b161b58161
parentcc2d9c4423d520d9d4d53aa2b57b47cef70651e2 (diff)
downloadobnam-252a5548fa8d7d90c736b27d8804ddabb0bad469.tar.gz
Log multiline StructuredError messages in full
-rw-r--r--obnamlib/app.py6
-rw-r--r--obnamlib/encryption.py2
2 files changed, 6 insertions, 2 deletions
diff --git a/obnamlib/app.py b/obnamlib/app.py
index 362ecf58..4505fc88 100644
--- a/obnamlib/app.py
+++ b/obnamlib/app.py
@@ -234,10 +234,14 @@ class App(cliapp.Application):
sys.stderr.write('ERROR: %s\n' % str(e))
sys.exit(1)
except obnamlib.StructuredError as e:
- logging.critical(str(e), exc_info=True)
+ logging.critical(self._indent_multiline(e.formatted()), exc_info=True)
sys.stderr.write('ERROR: %s\n' % e.formatted())
sys.exit(1)
+ def _indent_multiline(self, s):
+ lines = s.splitlines()
+ return ''.join([lines[0] + '\n'] + [' {}\n'.format(line) for line in lines[1:]])
+
def setup_ttystatus(self):
self.ts = ttystatus.TerminalStatus(period=0.1)
if self.settings['quiet']:
diff --git a/obnamlib/encryption.py b/obnamlib/encryption.py
index 35ac1da2..2dd12d3c 100644
--- a/obnamlib/encryption.py
+++ b/obnamlib/encryption.py
@@ -30,7 +30,7 @@ class EncryptionError(obnamlib.ObnamError):
class GpgError(EncryptionError):
- msg = ('gpg failed with exit code {returncode}:\n'
+ msg = ('gpg failed with exit code {returncode}\n'
'Command: {command}\n{stderr}')