From e9dff807d2d3fa5499f975a724cb813751b6a9a8 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sat, 6 Nov 2010 19:31:11 +0100 Subject: [PATCH] [entropy.client.services.ugc] do not let socket exceptions going through, but rather return error on execution --- libraries/entropy/client/services/ugc/commands.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libraries/entropy/client/services/ugc/commands.py b/libraries/entropy/client/services/ugc/commands.py index 89747ddaa..2c858cea5 100644 --- a/libraries/entropy/client/services/ugc/commands.py +++ b/libraries/entropy/client/services/ugc/commands.py @@ -237,11 +237,14 @@ class Base: if result == None: return False, 'command not supported' # untranslated on purpose return result - except (self.socket.error, self.struct.error,): - self.Service.reconnect_socket() + except (self.socket.error, self.struct.error,) as err: + try: + self.Service.reconnect_socket() + except self.socket.error as exc: + return False, 'connection error %s' % (exc,) tries -= 1 if tries < 1: - raise + return False, 'connection error %s' % (err,) def set_gzip_compression(self, session, do): self.Service.check_socket_connection()