From 735e57b73a27aa59960ca9a439e755d20124f4a5 Mon Sep 17 00:00:00 2001 From: Yeuoly Date: Sun, 29 Sep 2024 13:46:16 +0800 Subject: [PATCH] fix: transform generic error message into correct type --- api/core/plugin/manager/base.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/core/plugin/manager/base.py b/api/core/plugin/manager/base.py index cb402849e9..ebfa68b914 100644 --- a/api/core/plugin/manager/base.py +++ b/api/core/plugin/manager/base.py @@ -120,9 +120,10 @@ class BasePluginManager: if rep.code == -500: try: error = PluginDaemonError(**json.loads(rep.message)) - self._handle_plugin_daemon_error(error.error_type, error.message, error.args) except Exception as e: raise ValueError(f"got error from plugin daemon: {rep.message}, code: {rep.code}") + + self._handle_plugin_daemon_error(error.error_type, error.message, error.args) raise ValueError(f"got error from plugin daemon: {rep.message}, code: {rep.code}") if rep.data is None: raise ValueError("got empty data from plugin daemon") @@ -148,9 +149,10 @@ class BasePluginManager: if rep.code == -500: try: error = PluginDaemonError(**json.loads(rep.message)) - self._handle_plugin_daemon_error(error.error_type, error.message, error.args) except Exception as e: raise PluginDaemonInnerError(code=rep.code, message=rep.message) + + self._handle_plugin_daemon_error(error.error_type, error.message, error.args) raise ValueError(f"got error from plugin daemon: {rep.message}, code: {rep.code}") if rep.data is None: raise ValueError("got empty data from plugin daemon")