Catch JSON Errors

This commit is contained in:
Jack
2025-03-24 06:54:56 +02:00
parent 65aa5a5915
commit 71c45e1b41
2 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ from .modules.ipAdapter import ipAdapter
from .modules.ipAdapterCombine import ipAdapterCombine
from .modules.vaeSearch import vaeSearch
RUNWARE_COMFYUI_VERSION = "1.0.4 Beta"
RUNWARE_COMFYUI_VERSION = "1.0.5 Beta"
RESET_COLOR = "\033[0m"
BLUE_COLOR = "\033[94m"
+10 -2
View File
@@ -256,7 +256,7 @@ def inferenecRequest(genConfig):
try:
def recaller():
return session.post(
response = session.post(
RUNWARE_API_BASE_URL,
headers=headers,
json=genConfig,
@@ -264,9 +264,17 @@ def inferenecRequest(genConfig):
allow_redirects=False,
stream=True,
)
if response.status_code != 200:
print(f"[Debugging] Runware Response Status Code: {response.status_code}")
return response
genResult = generalRequestWrapper(recaller)
genResult = genResult.json()
try:
genResult = genResult.json()
except json.JSONDecodeError as e:
print(f"[Debugging] Runware JSON Decode Error: {str(e)}")
print(f"[Debugging] Runware Raw Response Content: {genResult.content}")
raise Exception("Error: Invalid JSON response from API!")
if "errors" in genResult:
raise Exception(genResult["errors"][0]["message"])
else: