From 23b5afbc4fe08914135621c28e6a69b8a3f0c6f5 Mon Sep 17 00:00:00 2001 From: Rhys Yang Date: Fri, 22 Mar 2024 00:05:10 +0800 Subject: [PATCH] Update the `Prompt Reader` node to the new exception handling method --- nodes.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/nodes.py b/nodes.py index 7881b59..a45f4c2 100644 --- a/nodes.py +++ b/nodes.py @@ -159,9 +159,8 @@ class SDPromptReader: file_path = Path(image_path) with open(file_path, "rb") as f: - try: - image_data = ImageDataReader(f) - except: + image_data = ImageDataReader(f) + if image_data.status.name == "COMFYUI_ERROR": output_to_terminal(ERROR_MESSAGE["complex_workflow"]) return self.error_output( error_message=ERROR_MESSAGE["complex_workflow"], @@ -171,8 +170,7 @@ class SDPromptReader: height=i.height, filename=file_path.stem, ) - - if not image_data.tool: + elif image_data.status.name in ["FORMAT_ERROR", "UNREAD"]: output_to_terminal(ERROR_MESSAGE["format_error"]) return self.error_output( error_message=ERROR_MESSAGE["format_error"],