src cleanup: get rid of text-as-bytes in borg.remote

This commit is contained in:
Thomas Waldmann 2016-08-15 15:52:19 +02:00
parent 1f056d9e8a
commit 3c8d86354b
1 changed files with 9 additions and 8 deletions

View File

@ -283,22 +283,23 @@ This problem will go away as soon as the server has been upgraded to 1.0.7+.
return msgid
def handle_error(error, res):
if error == b'DoesNotExist':
error = error.decode('utf-8')
if error == 'DoesNotExist':
raise Repository.DoesNotExist(self.location.orig)
elif error == b'AlreadyExists':
elif error == 'AlreadyExists':
raise Repository.AlreadyExists(self.location.orig)
elif error == b'CheckNeeded':
elif error == 'CheckNeeded':
raise Repository.CheckNeeded(self.location.orig)
elif error == b'IntegrityError':
elif error == 'IntegrityError':
raise IntegrityError(res)
elif error == b'PathNotAllowed':
elif error == 'PathNotAllowed':
raise PathNotAllowed(*res)
elif error == b'ObjectNotFound':
elif error == 'ObjectNotFound':
raise Repository.ObjectNotFound(res[0], self.location.orig)
elif error == b'InvalidRPCMethod':
elif error == 'InvalidRPCMethod':
raise InvalidRPCMethod(*res)
else:
raise self.RPCError(res.decode('utf-8'), error.decode('utf-8'))
raise self.RPCError(res.decode('utf-8'), error)
calls = list(calls)
waiting_for = []