1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-23 14:41:43 +00:00

show tracebacks in top-level exception handler for easier debugging

sure it is "prettier" without, but a lot of useful information for debugging is lost if the traceback is not shown.

even for KeyboardInterrupt:

it may have some bad reason when one has to use Ctrl-C - if attic was stuck somewhere, we want to know where it was.
This commit is contained in:
Thomas Waldmann 2015-04-01 23:12:06 +02:00
parent 4ab4ecc7af
commit 14d91a25fc

View file

@ -8,6 +8,7 @@
import stat import stat
import sys import sys
import textwrap import textwrap
import traceback
from attic import __version__ from attic import __version__
from attic.archive import Archive, ArchiveChecker from attic.archive import Archive, ArchiveChecker
@ -726,9 +727,11 @@ def main():
try: try:
exit_code = archiver.run(sys.argv[1:]) exit_code = archiver.run(sys.argv[1:])
except Error as e: except Error as e:
traceback.print_exc()
archiver.print_error(e.get_message()) archiver.print_error(e.get_message())
exit_code = e.exit_code exit_code = e.exit_code
except KeyboardInterrupt: except KeyboardInterrupt:
traceback.print_exc()
archiver.print_error('Error: Keyboard interrupt') archiver.print_error('Error: Keyboard interrupt')
exit_code = 1 exit_code = 1
else: else: