From 84e7a5c5086f1b0996c1122923704292bb3b29ec Mon Sep 17 00:00:00 2001 From: Yeuoly Date: Tue, 13 May 2025 17:08:47 +0800 Subject: [PATCH 1/2] fix: handle EndpointSetupFailedError in BasePluginClient --- api/core/plugin/impl/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/core/plugin/impl/base.py b/api/core/plugin/impl/base.py index 4f1d808a3ecaee..591e7b05256314 100644 --- a/api/core/plugin/impl/base.py +++ b/api/core/plugin/impl/base.py @@ -17,6 +17,7 @@ InvokeServerUnavailableError, ) from core.model_runtime.errors.validate import CredentialsValidateFailedError +from core.plugin.endpoint.exc import EndpointSetupFailedError from core.plugin.entities.plugin_daemon import PluginDaemonBasicResponse, PluginDaemonError, PluginDaemonInnerError from core.plugin.impl.exc import ( PluginDaemonBadRequestError, @@ -219,6 +220,8 @@ def _handle_plugin_daemon_error(self, error_type: str, message: str): raise InvokeServerUnavailableError(description=args.get("description")) case CredentialsValidateFailedError.__name__: raise CredentialsValidateFailedError(error_object.get("message")) + case EndpointSetupFailedError.__name__: + raise EndpointSetupFailedError(error_object.get("message")) case _: raise PluginInvokeError(description=message) case PluginDaemonInternalServerError.__name__: From 02d059655d26f7c42c79026a3c55087be5f5b746 Mon Sep 17 00:00:00 2001 From: Yeuoly Date: Tue, 13 May 2025 17:13:05 +0800 Subject: [PATCH 2/2] feat: add EndpointSetupFailedError exception for better error handling --- api/core/plugin/endpoint/exc.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 api/core/plugin/endpoint/exc.py diff --git a/api/core/plugin/endpoint/exc.py b/api/core/plugin/endpoint/exc.py new file mode 100644 index 00000000000000..aa29f1e9a196aa --- /dev/null +++ b/api/core/plugin/endpoint/exc.py @@ -0,0 +1,6 @@ +class EndpointSetupFailedError(ValueError): + """ + Endpoint setup failed error + """ + + pass