Ver código fonte

fix: skip json transforming if error occurs

Yeuoly 5 meses atrás
pai
commit
80d8e47e42
1 arquivos alterados com 4 adições e 0 exclusões
  1. 4 0
      api/core/plugin/manager/agent.py

+ 4 - 0
api/core/plugin/manager/agent.py

@@ -48,6 +48,10 @@ class PluginAgentManager(BasePluginManager):
         agent_provider_id = GenericProviderID(provider)
 
         def transformer(json_response: dict[str, Any]) -> dict:
+            # skip if error occurs
+            if json_response.get("data") is None or json_response.get("data", {}).get("declaration") is None:
+                return json_response
+
             for strategy in json_response.get("data", {}).get("declaration", {}).get("strategies", []):
                 strategy["identity"]["provider"] = agent_provider_id.provider_name