From 562b34ad7601e5e7237ddf71a2700e8d14fa02c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 9 Nov 2017 19:03:02 +0100 Subject: [PATCH] Process exception during the callback As process exception may raise an exception, it should be run in the callback to let the caller catch it. Otherwise it is raised in the thread and never catch. issue6907 review42811003 --- tryton/common/common.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tryton/common/common.py b/tryton/common/common.py index 24c88e4713..9654d62d87 100644 --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -1191,17 +1191,15 @@ class RPCProgress(object): def process(self): if self.parent and self.parent.get_window(): self.parent.get_window().set_cursor(None) - if self.exception: - if self.process_exception_p: - def rpc_execute(*args): - return RPCProgress('execute', - args).run(self.process_exception_p, self.callback) - return process_exception(self.exception, *self.args, - rpc_execute=rpc_execute) def return_(): if self.exception: - raise self.exception + if self.process_exception_p: + def rpc_execute(*args): + return RPCProgress('execute', + args).run(self.process_exception_p, self.callback) + return process_exception(self.exception, *self.args, + rpc_execute=rpc_execute) else: return self.res