From 93287f22a82b634635376143403e803ac85cb1d8 Mon Sep 17 00:00:00 2001 From: Valor <2889618983@qq.com> Date: Mon, 7 Sep 2026 13:52:29 +0000 Subject: [PATCH] refactor: preserve exception context when re-raising in except blocks (#40432) Co-authored-by: Asuka Minato --- api/core/plugin/impl/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/core/plugin/impl/base.py b/api/core/plugin/impl/base.py index e26a04e71ae..f8d8dbfc981 100644 --- a/api/core/plugin/impl/base.py +++ b/api/core/plugin/impl/base.py @@ -380,8 +380,8 @@ class BasePluginClient: if rep.code == -500: try: error = PluginDaemonError.model_validate(json.loads(rep.message)) - except Exception: - raise PluginDaemonInnerError(code=rep.code, message=rep.message) + except Exception as e: + raise PluginDaemonInnerError(code=rep.code, message=rep.message) from e logger.error("Error in stream response for plugin %s", rep.__dict__) self._handle_plugin_daemon_error(error.error_type, error.message)