Return 404 instead of 500 when workflow not found (#SKY-7256) (#4699)

This commit is contained in:
Celal Zamanoglu
2026-02-11 16:31:38 +03:00
committed by GitHub
parent 5e9c1f4f68
commit cc84c927f2
2 changed files with 42 additions and 25 deletions

View File

@@ -41,6 +41,7 @@ from skyvern.exceptions import (
MissingValueForParameter,
ScriptTerminationException,
SkyvernException,
SkyvernHTTPException,
WorkflowNotFound,
WorkflowNotFoundForWorkflowRun,
WorkflowRunNotFound,
@@ -3432,6 +3433,12 @@ class WorkflowService:
)
return updated_workflow
except SkyvernHTTPException:
# Bubble up well-formed client errors (e.g. WorkflowNotFound 404)
# so they are not wrapped in a 500 by the caller.
if new_workflow_id:
await self.delete_workflow_by_id(workflow_id=new_workflow_id, organization_id=organization_id)
raise
except Exception as e:
if new_workflow_id:
LOG.error(