throw better error message

This commit is contained in:
bedovyy
2026-07-03 14:20:21 +09:00
parent 382467aceb
commit 8a7782867f
2 changed files with 14 additions and 2 deletions
+13 -1
View File
@@ -72,7 +72,19 @@ class PostChatCompletions(io.ComfyNode):
text_chunks = []
async with aiohttp.ClientSession() as session, \
session.post(url, headers=headers, json=body, timeout=timeout) as resp:
resp.raise_for_status()
# resp.raise_for_status()
if resp.status != 200:
error_text = await resp.text()
try:
logger.error(f"API Error ({resp.status}): {error_text}")
error_json = json.loads(error_text)
error_msg = error_json.get("message", error_text)
for line in filter(None, map(str.strip, error_msg.splitlines())):
logger.error(f" - {line}")
except:
error_msg = error_text
raise RuntimeError(f"API Error ({resp.status}):\n{error_msg}")
if not is_stream:
result_json = await resp.json()
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "ComfyUI-LLM-Helper"
description = "A custom nodes for LLM API"
version = "1.0.5" # Custom Node version. Must be semantically versioned.
version = "1.0.6" # Custom Node version. Must be semantically versioned.
license = { file = "LICENSE" }
dependencies = [
"python-dotenv"