From 993dbe4e62525e5fd7361faba6cb5fdf95d2d931 Mon Sep 17 00:00:00 2001 From: VILLARD Florian Date: Thu, 16 Jan 2025 12:11:33 +0100 Subject: [PATCH] trying throw error --- colormatrix_gpu_node.py | 27 +++++++++++++++++++-------- comfyui_nodes.json | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/colormatrix_gpu_node.py b/colormatrix_gpu_node.py index dd8c7c1..05e24d6 100644 --- a/colormatrix_gpu_node.py +++ b/colormatrix_gpu_node.py @@ -222,14 +222,23 @@ def split_image_to_grid(input_image, grid_size=(5, 5)): return grid_images def upload_image_to_s3(index, image, bucket_name, object_name, s3_client): - # Convert image to a bytes buffer - buffer = BytesIO() - image.save(buffer, format="PNG") - buffer.seek(0) + try: + # Convert image to a bytes buffer + buffer = BytesIO() + image.save(buffer, format="PNG") + buffer.seek(0) - # Upload the image to S3 - s3_client.upload_fileobj(buffer, bucket_name, object_name) - return index, True + # Upload the image to S3 + s3_client.upload_fileobj(buffer, bucket_name, object_name) + return index, True + except ClientError as e: + # Log the error and raise it for further handling + print(f"Error uploading image {index} to S3: {e}") + return index, False + except Exception as e: + # Handle any other unexpected exceptions + print(f"Unexpected error for image {index}: {e}") + return index, False class SaveGridToS3: @@ -285,9 +294,11 @@ class SaveGridToS3: index, success = future.result() bools[index] = success except Exception as e: - print(f"Error posting : {e}") + raise RuntimeError("Error posting : {e}") if any(img is None for img in bools): raise RuntimeError("Some images failed to upload.") + if any(img is False for img in bools): + raise RuntimeError("Some images failed to upload.") except Exception as e: raise ValueError(f"Invalid input: {e}") diff --git a/comfyui_nodes.json b/comfyui_nodes.json index a5b420a..40df7b6 100644 --- a/comfyui_nodes.json +++ b/comfyui_nodes.json @@ -2,7 +2,7 @@ "name": "ColorMatrixGPU", "description": "A ComfyUI node to apply a 4x4 color matrix to an image using GPU acceleration.", "author": "Argo", - "version": "1.1.2", + "version": "1.2.0", "repository": "https://github.com/bear2b/comfyui-argo-nodes", "dependencies": [ "torch>=1.13.0",