Skip to content

Commit

Permalink
fix: raise http request node error on httpx.request error (#11954)
Browse files Browse the repository at this point in the history
Signed-off-by: -LAN- <laipz8200@outlook.com>
  • Loading branch information
laipz8200 authored Dec 22, 2024
1 parent 5db8add commit 2c4df10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion api/core/ops/ops_trace_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,13 @@ def preprocess(self):
def conversation_trace(self, **kwargs):
return kwargs

def workflow_trace(self, workflow_run: WorkflowRun, conversation_id, user_id):
def workflow_trace(self, workflow_run: WorkflowRun | None, conversation_id, user_id):
if not workflow_run:
raise ValueError("Workflow run not found")

db.session.merge(workflow_run)
db.sessoin.refresh(workflow_run)

workflow_id = workflow_run.workflow_id
tenant_id = workflow_run.tenant_id
workflow_run_id = workflow_run.id
Expand Down
2 changes: 2 additions & 0 deletions api/core/workflow/nodes/http_request/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ def _do_http_request(self, headers: dict[str, Any]) -> httpx.Response:
# request_args = {k: v for k, v in request_args.items() if v is not None}
try:
response = getattr(ssrf_proxy, self.method)(**request_args)
except httpx.RequestError as e:
raise HttpRequestNodeError(str(e))
except ssrf_proxy.MaxRetriesExceededError as e:
raise HttpRequestNodeError(str(e))
return response
Expand Down

0 comments on commit 2c4df10

Please sign in to comment.