From 38cbc357b209d995cc56975b3514461e52688bc4 Mon Sep 17 00:00:00 2001 From: somebody Date: Sun, 27 Nov 2022 12:57:21 -0600 Subject: [PATCH] Improve SD error handling --- aiserver.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/aiserver.py b/aiserver.py index 0a520b66..4ff7455f 100644 --- a/aiserver.py +++ b/aiserver.py @@ -9381,6 +9381,17 @@ def text2img_api(prompt, try: submit_req = requests.post(url=apiaddress, data=payload_json) + except requests.exceptions.ConnectionError: + show_error_notification( + "SD Web API Failure", + "Unable to connect to SD Web UI. Is it running?", + do_log=True + ) + return None + except Exception as e: + show_error_notification("SD Web API Failure", "Unknown error in connecting to the SD Web UI. Is it running?") + logger.error(f"{type(e)}: {e}") + return None finally: koboldai_vars.generating_image = False