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