From cc5a8924d16696f8a6a1c8abf440bcf2b894df8a Mon Sep 17 00:00:00 2001 From: Abdullah Alfaraj <7842232+AbdullahAlfaraj@users.noreply.github.com> Date: Mon, 27 Nov 2023 03:01:57 +0300 Subject: [PATCH] throw an error comfyui is offline --- typescripts/comfyui/util.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/typescripts/comfyui/util.ts b/typescripts/comfyui/util.ts index 5394932..ac0fdc6 100644 --- a/typescripts/comfyui/util.ts +++ b/typescripts/comfyui/util.ts @@ -221,6 +221,11 @@ export async function postPromptAndGetBase64JsonResult( }> { try { const res = await comfyapi.comfy_api.prompt(prompt) + if (!res) { + throw new Error( + `Unable to establish a connection to ComfyUI at the provided address: ${comfyapi.comfy_api.comfy_url}. Please ensure that ComfyUI is online and the URL is correct.` + ) + } if (res.error) { const readable_error = comfyapi.comfy_api.getReadableError(res) throw new Error(readable_error)