Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
chore: improve error logging for requests to plugin daemon (#20328)
Bowen Liangeee88a80128f
diff --git a/api/core/plugin/impl/base.py b/api/core/plugin/impl/base.pyindex 591e7b05256..7b9592bff34 100644--- a/api/core/plugin/impl/base.py+++ b/api/core/plugin/impl/base.py@@ -6,6 +6,7 @@ from typing import TypeVarimport requestsfrom pydantic import BaseModel+from requests.exceptions import HTTPErrorfrom yarl import URLfrom configs import dify_config@@ -136,12 +137,31 @@ class BasePluginClient:"""Make a request to the plugin daemon inner API and return the response as a model."""- response = self._request(method, path, headers, data, params, files)- json_response = response.json()- if transformer:- json_response = transformer(json_response)+ try:+ response = self._request(method, path, headers, data, params, files)+ response.raise_for_status()+ except HTTPError as e:+ msg = f"Failed to request plugin daemon, status: {e.response.status_code}, url: {path}"+ logging.exception(msg)+ raise e+ except Exception as e:+ msg = f"Failed to request plugin daemon, url: {path}"+ logging.exception(msg)+ raise ValueError(msg) from e++ try:+ json_response = response.json()+ if transformer:+ json_response = transformer(json_response)+ rep = PluginDaemonBasicResponse[type](**json_response) # type: ignore+ except Exception:+ msg = (+ f"Failed to parse response from plugin daemon to PluginDaemonBasicResponse [{str(type.__name__)}],"+ f" url: {path}"+ )+ logging.exception(msg)+ raise ValueError(msg)- rep = PluginDaemonBasicResponse[type](**json_response) # type: ignoreif rep.code != 0:try:error = PluginDaemonError(**json.loads(rep.message))