changeset ecaf2dd04f42 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset&node=ecaf2dd04f42
description:
        Do not convert exceptions in HTTPException for RPC calls

        issue11483
        review423381003
diffstat:

 trytond/protocols/wrappers.py |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r aea9719d95e6 -r ecaf2dd04f42 trytond/protocols/wrappers.py
--- a/trytond/protocols/wrappers.py     Fri Jun 10 12:33:37 2022 +0200
+++ b/trytond/protocols/wrappers.py     Wed Jun 15 18:52:38 2022 +0200
@@ -165,10 +165,16 @@
             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
 
 

Reply via email to