fix: enhance error handling in build_flow and add error handling for Flow build (#3259)
* feat: add error handling for Flow build The code changes in `buildUtils.ts` add error handling for the Flow build process. It includes a new case for handling errors in the switch statement, which displays the error message and triggers the `onBuildError` function. This change ensures that errors during the Flow build are properly handled and the build process is stopped. * feat: enhance error handling in build_flow to capture and report HTTP exceptions in the flow building process
This commit is contained in:
parent
645c723d21
commit
d0484ba412
2 changed files with 22 additions and 1 deletions
|
|
@ -356,10 +356,23 @@ async def build_flow(
|
|||
except asyncio.CancelledError:
|
||||
vertices_task.cancel()
|
||||
return
|
||||
except Exception as e:
|
||||
if isinstance(e, HTTPException):
|
||||
send_event("error", {"error": str(e.detail), "statusCode": e.status_code}, queue)
|
||||
raise e
|
||||
send_event("error", {"error": str(e)}, queue)
|
||||
raise e
|
||||
|
||||
ids, vertices_to_run, graph = vertices_task.result()
|
||||
else:
|
||||
ids, vertices_to_run, graph = await build_graph_and_get_order()
|
||||
try:
|
||||
ids, vertices_to_run, graph = await build_graph_and_get_order()
|
||||
except Exception as e:
|
||||
if isinstance(e, HTTPException):
|
||||
send_event("error", {"error": str(e.detail), "statusCode": e.status_code}, queue)
|
||||
raise e
|
||||
send_event("error", {"error": str(e)}, queue)
|
||||
raise e
|
||||
send_event("vertices_sorted", {"ids": ids, "to_run": vertices_to_run}, queue)
|
||||
await client_consumed_queue.get()
|
||||
|
||||
|
|
|
|||
|
|
@ -264,6 +264,14 @@ export async function buildFlowVertices({
|
|||
useFlowStore.getState().setIsBuilding(false);
|
||||
return true;
|
||||
}
|
||||
case "error": {
|
||||
const errorMessage = data.error;
|
||||
console.log(data);
|
||||
onBuildError!("Error Running Flow", [errorMessage], []);
|
||||
buildResults.push(false);
|
||||
useFlowStore.getState().setIsBuilding(false);
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue