mirror of https://github.com/borgbackup/borg.git
Merge pull request #838 from enkore/issue/792
Remote: don't print tracebacks for Error exceptions handled downstream
This commit is contained in:
commit
9a7bad295c
|
@ -82,6 +82,7 @@ class RepositoryServer: # pragma: no cover
|
||||||
unpacker.feed(data)
|
unpacker.feed(data)
|
||||||
for unpacked in unpacker:
|
for unpacked in unpacker:
|
||||||
if not (isinstance(unpacked, tuple) and len(unpacked) == 4):
|
if not (isinstance(unpacked, tuple) and len(unpacked) == 4):
|
||||||
|
self.repository.close()
|
||||||
raise Exception("Unexpected RPC data format.")
|
raise Exception("Unexpected RPC data format.")
|
||||||
type, msgid, method, args = unpacked
|
type, msgid, method, args = unpacked
|
||||||
method = method.decode('ascii')
|
method = method.decode('ascii')
|
||||||
|
@ -94,6 +95,10 @@ class RepositoryServer: # pragma: no cover
|
||||||
f = getattr(self.repository, method)
|
f = getattr(self.repository, method)
|
||||||
res = f(*args)
|
res = f(*args)
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
|
# These exceptions are reconstructed on the client end in RemoteRepository.call_many(),
|
||||||
|
# and will be handled just like locally raised exceptions. Suppress the remote traceback
|
||||||
|
# for these, except ErrorWithTraceback, which should always display a traceback.
|
||||||
|
if not isinstance(e, (Repository.DoesNotExist, Repository.AlreadyExists, PathNotAllowed)):
|
||||||
logging.exception('Borg %s: exception in RPC call:', __version__)
|
logging.exception('Borg %s: exception in RPC call:', __version__)
|
||||||
logging.error(sysinfo())
|
logging.error(sysinfo())
|
||||||
exc = "Remote Exception (see remote log for the traceback)"
|
exc = "Remote Exception (see remote log for the traceback)"
|
||||||
|
@ -164,7 +169,11 @@ class RemoteRepository:
|
||||||
raise ConnectionClosedWithHint('Is borg working on the server?') from None
|
raise ConnectionClosedWithHint('Is borg working on the server?') from None
|
||||||
if version != RPC_PROTOCOL_VERSION:
|
if version != RPC_PROTOCOL_VERSION:
|
||||||
raise Exception('Server insisted on using unsupported protocol version %d' % version)
|
raise Exception('Server insisted on using unsupported protocol version %d' % version)
|
||||||
self.id = self.call('open', location.path, create, lock_wait, lock)
|
try:
|
||||||
|
self.id = self.call('open', self.location.path, create, lock_wait, lock)
|
||||||
|
except Exception:
|
||||||
|
self.close()
|
||||||
|
raise
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if self.p:
|
if self.p:
|
||||||
|
|
Loading…
Reference in New Issue