From 638f5505fab32c7b8eeed454edd265e27019dd60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 15 Jun 2022 18:52:38 +0200 Subject: [PATCH] Do not convert exceptions in HTTPException for RPC calls issue11483 review423381003 --- trytond/protocols/wrappers.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/trytond/protocols/wrappers.py b/trytond/protocols/wrappers.py index 7172fd2e81..a056ab0c4f 100644 --- a/trytond/protocols/wrappers.py +++ b/trytond/protocols/wrappers.py @@ -165,10 +165,16 @@ def with_pool(func): raise except (UserError, UserWarning) as e: logger.debug('%s', request, exc_info=True) - abort(HTTPStatus.BAD_REQUEST, e) + if request.rpc_method: + raise + else: + abort(HTTPStatus.BAD_REQUEST, e) except Exception as e: logger.error('%s', request, exc_info=True) - abort(HTTPStatus.INTERNAL_SERVER_ERROR, e) + if request.rpc_method: + raise + else: + abort(HTTPStatus.INTERNAL_SERVER_ERROR, e) return wrapper