From 6b99b8a66adc5fb17b42508dea3f9814f08f81a6 Mon Sep 17 00:00:00 2001 From: BennyKok Date: Fri, 29 Dec 2023 16:53:32 +0800 Subject: [PATCH] fix(plugin): ensure node_errors is sent --- custom_routes.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/custom_routes.py b/custom_routes.py index 282b23f..861fb3a 100644 --- a/custom_routes.py +++ b/custom_routes.py @@ -107,15 +107,30 @@ async def comfy_deploy_run(request): stack_trace = traceback.format_exc().strip() print(f"error: {error_type}, {e}") print(f"stack trace: {stack_trace_short}") - asyncio.create_task(update_run_with_output(prompt_id, { - "error_type": error_type, - "stack_trace": stack_trace - })) + await update_run_with_output(prompt_id, { + "error": { + "error_type": error_type, + "stack_trace": stack_trace + } + }) return web.Response(status=500, reason=f"{error_type}: {e}, {stack_trace_short}") status = 200 if "error" in res: status = 400 + await update_run_with_output(prompt_id, { + "error": { + **res + } + }) + + if "node_errors" in res: + status = 400 + await update_run_with_output(prompt_id, { + "error": { + **res + } + }) return web.json_response(res, status=status)