mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-20 21:27:32 +00:00
remote: show path in PathNotAllowed
not 100 % sure whether "if old_server" is required, so let's play it safe. 1.0 -> 1.1 server is no problem.
This commit is contained in:
parent
07fbba4ee9
commit
8dfe2a8080
2 changed files with 8 additions and 4 deletions
|
@ -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)
|
||||
|
|
|
@ -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'})
|
||||
|
|
Loading…
Reference in a new issue