From fee36419acfcea963a226dfa4c2b1208244f4a0f Mon Sep 17 00:00:00 2001 From: Theros Date: Wed, 10 Jul 2024 23:41:06 +0100 Subject: [PATCH 1/2] Includes captioning error messages in toast --- public/scripts/extensions/caption/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/scripts/extensions/caption/index.js b/public/scripts/extensions/caption/index.js index b47f73a2f..c8ac72017 100644 --- a/public/scripts/extensions/caption/index.js +++ b/public/scripts/extensions/caption/index.js @@ -333,7 +333,7 @@ async function getCaptionForFile(file, prompt, quiet) { return caption; } catch (error) { - toastr.error('Failed to caption image.'); + toastr.error(`Failed to caption image. ${error}`); console.log(error); return ''; } From 51f09c13823bf84743e395dd9fb5b431e7022725 Mon Sep 17 00:00:00 2001 From: Theros Date: Thu, 11 Jul 2024 00:12:39 +0100 Subject: [PATCH 2/2] Changes: use Fail message as toast title, only show actual message with fallback. --- public/scripts/extensions/caption/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/scripts/extensions/caption/index.js b/public/scripts/extensions/caption/index.js index c8ac72017..dbfbc0d1d 100644 --- a/public/scripts/extensions/caption/index.js +++ b/public/scripts/extensions/caption/index.js @@ -333,8 +333,9 @@ async function getCaptionForFile(file, prompt, quiet) { return caption; } catch (error) { - toastr.error(`Failed to caption image. ${error}`); - console.log(error); + const errorMessage = error.message || 'Unknown error'; + toastr.error(errorMessage, "Failed to caption image."); + console.error(error); return ''; } finally {