mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-22 14:11:27 +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):
|
class PathNotAllowed(Error):
|
||||||
"""Repository path not allowed"""
|
"""Repository path not allowed: {}"""
|
||||||
|
|
||||||
|
|
||||||
class InvalidRPCMethod(Error):
|
class InvalidRPCMethod(Error):
|
||||||
|
@ -391,7 +391,7 @@ def inject_exception(self, kind):
|
||||||
elif kind == 'IntegrityError':
|
elif kind == 'IntegrityError':
|
||||||
raise IntegrityError(s1)
|
raise IntegrityError(s1)
|
||||||
elif kind == 'PathNotAllowed':
|
elif kind == 'PathNotAllowed':
|
||||||
raise PathNotAllowed()
|
raise PathNotAllowed('foo')
|
||||||
elif kind == 'ObjectNotFound':
|
elif kind == 'ObjectNotFound':
|
||||||
raise Repository.ObjectNotFound(s1, s2)
|
raise Repository.ObjectNotFound(s1, s2)
|
||||||
elif kind == 'InvalidRPCMethod':
|
elif kind == 'InvalidRPCMethod':
|
||||||
|
@ -747,7 +747,10 @@ def handle_error(unpacked):
|
||||||
else:
|
else:
|
||||||
raise IntegrityError(args[0].decode())
|
raise IntegrityError(args[0].decode())
|
||||||
elif error == 'PathNotAllowed':
|
elif error == 'PathNotAllowed':
|
||||||
raise PathNotAllowed()
|
if old_server:
|
||||||
|
raise PathNotAllowed('(unknown)')
|
||||||
|
else:
|
||||||
|
raise PathNotAllowed(args[0].decode())
|
||||||
elif error == 'ObjectNotFound':
|
elif error == 'ObjectNotFound':
|
||||||
if old_server:
|
if old_server:
|
||||||
raise Repository.ObjectNotFound('(not available)', self.location.orig)
|
raise Repository.ObjectNotFound('(not available)', self.location.orig)
|
||||||
|
|
|
@ -815,7 +815,8 @@ def test_rpc_exception_transport(self):
|
||||||
try:
|
try:
|
||||||
self.repository.call('inject_exception', {'kind': 'PathNotAllowed'})
|
self.repository.call('inject_exception', {'kind': 'PathNotAllowed'})
|
||||||
except PathNotAllowed as e:
|
except PathNotAllowed as e:
|
||||||
assert len(e.args) == 0
|
assert len(e.args) == 1
|
||||||
|
assert e.args[0] == 'foo'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.repository.call('inject_exception', {'kind': 'ObjectNotFound'})
|
self.repository.call('inject_exception', {'kind': 'ObjectNotFound'})
|
||||||
|
|
Loading…
Reference in a new issue