Reviewers: ,
Please review this at http://codereview.tryton.org/147001/
Affected files:
M tryton/client.py
M tryton/common/common.py
M tryton/rpc.py
Index: tryton/client.py
===================================================================
--- a/tryton/client.py
+++ b/tryton/client.py
@@ -97,17 +97,9 @@
if hasattr(signal, 'SIGQUIT'):
signal.signal(signal.SIGQUIT, lambda signum, frame:
main.sig_quit())
- def excepthook(exctyp, value, tb):
+ def excepthook(exctyp, exception, tb):
import common
-
- if str(value) == 'NotLogged':
- return
-
- tb_s = reduce(lambda x, y: x+y,
- traceback.format_exception(exctyp, value, tb))
- for path in sys.path:
- tb_s = tb_s.replace(path, '')
- common.error(str(value), tb_s)
+ common.process_exception(exception)
sys.excepthook = excepthook
Index: tryton/common/common.py
===================================================================
--- a/tryton/common/common.py
+++ b/tryton/common/common.py
@@ -1050,10 +1050,7 @@
finally:
PLOCK.release()
elif isinstance(exception, (socket.error, TrytonServerUnavailable)):
- msg = ''
- if len(exception.args) > 2:
- msg = exception.args[1]
- warning(msg, _('Network Error!'))
+ warning(str(exception), _('Network Error!'))
return False
if isinstance(exception, TrytonServerError):
@@ -1129,6 +1126,8 @@
try:
dbs = refresh_dblist(self.host, self.port)
createdb = True
+ except Exception:
+ pass
finally:
self.db_info = (dbs, createdb)
self.updated.set()
@@ -1184,7 +1183,7 @@
def start(self):
try:
self.res = getattr(rpc, self.method)(*self.args)
- except TrytonServerError, exception:
+ except Exception, exception:
self.error = True
self.res = False
self.exception = exception
Index: tryton/rpc.py
===================================================================
--- a/tryton/rpc.py
+++ b/tryton/rpc.py
@@ -63,8 +63,7 @@
logging.getLogger('rpc.result').debug(repr(result))
return result
except (Fault, socket.error):
- logging.getLogger('rpc.result').debug(repr(None))
- return None
+ raise
def login(username, password, host, port, database):
global CONNECTION, _USER, _USERNAME, _SESSION, _HOST, _PORT,
_DATABASE, _VIEW_CACHE
@@ -177,8 +176,8 @@
args = (_USER, _SESSION) + args[3:]
logging.getLogger('rpc.request').info('%s%s' % (name, args))
result = getattr(CONNECTION, name)(*args)
- except httplib.CannotSendRequest, exception:
- raise TrytonServerUnavailable(exception)
+ except (httplib.CannotSendRequest, socket.error), exception:
+ raise TrytonServerUnavailable(*exception.args)
finally:
_SEMAPHORE.release()
if key and method == 'fields_view_get':
--
[email protected] mailing list