mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-24 07:01:59 +00:00
catch all Exceptions, transmit traceback back from remote
before this changesets, most informations about exceptions/tracebacks on the remote side were lost. now they are transmitted and displayed, together with the remote attic version.
This commit is contained in:
parent
4ab4ecc7af
commit
c679f1a6f0
2 changed files with 11 additions and 4 deletions
|
@ -728,6 +728,9 @@ def main():
|
|||
except Error as e:
|
||||
archiver.print_error(e.get_message())
|
||||
exit_code = e.exit_code
|
||||
except RemoteRepository.RPCError as e:
|
||||
print(e)
|
||||
exit_code = 1
|
||||
except KeyboardInterrupt:
|
||||
archiver.print_error('Error: Keyboard interrupt')
|
||||
exit_code = 1
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
from subprocess import Popen, PIPE
|
||||
import sys
|
||||
import tempfile
|
||||
import traceback
|
||||
|
||||
from attic import __version__
|
||||
|
||||
from .hashindex import NSIndex
|
||||
from .helpers import Error, IntegrityError
|
||||
|
@ -52,8 +55,9 @@ def serve(self):
|
|||
except AttributeError:
|
||||
f = getattr(self.repository, method)
|
||||
res = f(*args)
|
||||
except Exception as e:
|
||||
sys.stdout.buffer.write(msgpack.packb((1, msgid, e.__class__.__name__, e.args)))
|
||||
except BaseException as e:
|
||||
exc = "Remote Traceback by Attic %s%s%s" % (__version__, os.linesep, traceback.format_exc())
|
||||
sys.stdout.buffer.write(msgpack.packb((1, msgid, e.__class__.__name__, exc)))
|
||||
else:
|
||||
sys.stdout.buffer.write(msgpack.packb((1, msgid, None, res)))
|
||||
sys.stdout.flush()
|
||||
|
@ -157,7 +161,7 @@ def fetch_from_cache(args):
|
|||
raise PathNotAllowed(*res)
|
||||
if error == b'ObjectNotFound':
|
||||
raise Repository.ObjectNotFound(res[0], self.location.orig)
|
||||
raise self.RPCError(error)
|
||||
raise self.RPCError(res.decode('utf-8'))
|
||||
else:
|
||||
yield res
|
||||
if not waiting_for and not calls:
|
||||
|
@ -312,4 +316,4 @@ def get_many(self, keys):
|
|||
def cache_if_remote(repository):
|
||||
if isinstance(repository, RemoteRepository):
|
||||
return RepositoryCache(repository)
|
||||
return repository
|
||||
return repository
|
||||
|
|
Loading…
Reference in a new issue