diff --git a/src/borg/remote.py b/src/borg/remote.py index b4810a5b7..5dc2a495a 100644 --- a/src/borg/remote.py +++ b/src/borg/remote.py @@ -87,7 +87,7 @@ class ConnectionClosedWithHint(ConnectionClosed): class PathNotAllowed(Error): - """Repository path not allowed""" + """Repository path not allowed: {}""" class InvalidRPCMethod(Error): @@ -391,7 +391,7 @@ def inject_exception(self, kind): elif kind == 'IntegrityError': raise IntegrityError(s1) elif kind == 'PathNotAllowed': - raise PathNotAllowed() + raise PathNotAllowed('foo') elif kind == 'ObjectNotFound': raise Repository.ObjectNotFound(s1, s2) elif kind == 'InvalidRPCMethod': @@ -747,7 +747,10 @@ def handle_error(unpacked): else: raise IntegrityError(args[0].decode()) elif error == 'PathNotAllowed': - raise PathNotAllowed() + if old_server: + raise PathNotAllowed('(unknown)') + else: + raise PathNotAllowed(args[0].decode()) elif error == 'ObjectNotFound': if old_server: raise Repository.ObjectNotFound('(not available)', self.location.orig) diff --git a/src/borg/testsuite/repository.py b/src/borg/testsuite/repository.py index 4efd0d214..25e112bda 100644 --- a/src/borg/testsuite/repository.py +++ b/src/borg/testsuite/repository.py @@ -815,7 +815,8 @@ def test_rpc_exception_transport(self): try: self.repository.call('inject_exception', {'kind': 'PathNotAllowed'}) except PathNotAllowed as e: - assert len(e.args) == 0 + assert len(e.args) == 1 + assert e.args[0] == 'foo' try: self.repository.call('inject_exception', {'kind': 'ObjectNotFound'})