From c7154ffb27ec23718891e8d8612f78718c7e7fd6 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sat, 6 Jan 2024 15:10:24 -0600 Subject: [PATCH] start adding specific error messages --- gui/src/components/card/ErrorCard.tsx | 16 ++++++++++++---- gui/src/strings/de.ts | 4 ++++ gui/src/strings/en.ts | 4 ++++ gui/src/strings/es.ts | 4 ++++ gui/src/strings/fr.ts | 4 ++++ 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/gui/src/components/card/ErrorCard.tsx b/gui/src/components/card/ErrorCard.tsx index 7d2311f4..030e9e0a 100644 --- a/gui/src/components/card/ErrorCard.tsx +++ b/gui/src/components/card/ErrorCard.tsx @@ -52,9 +52,9 @@ export function ErrorCard(props: ErrorCardProps) { sx={{ alignItems: 'center' }} > - {t('loading.progress', image.steps)} + {t('loading.progress', image)}
- {getImageErrorReason(image)} + {t(getImageErrorReason(image))}
@@ -83,10 +83,18 @@ export function selectActions(state: OnnxState) { }; } +export const IMAGE_ERROR = 'error.image.'; +export const UNKNOWN_ERROR = `${IMAGE_ERROR}unknown`; + export function getImageErrorReason(image: FailedJobResponse | UnknownJobResponse) { if (image.status === JobStatus.FAILED) { - return image.error; + const error = image.error; + if (doesExist(error) && error.startsWith(IMAGE_ERROR)) { + return error; + } + + return `${IMAGE_ERROR}.${error}`; } - return ''; + return UNKNOWN_ERROR; } diff --git a/gui/src/strings/de.ts b/gui/src/strings/de.ts index 01c1b02a..f3727477 100644 --- a/gui/src/strings/de.ts +++ b/gui/src/strings/de.ts @@ -12,6 +12,10 @@ export const I18N_STRINGS_DE = { }, convert: '', error: { + image: { + memory: '', + unknown: '', + }, inpaint: { support: '', }, diff --git a/gui/src/strings/en.ts b/gui/src/strings/en.ts index 9aa16e73..de691a79 100644 --- a/gui/src/strings/en.ts +++ b/gui/src/strings/en.ts @@ -7,6 +7,10 @@ export const I18N_STRINGS_EN = { }, convert: 'Save and Convert', error: { + image: { + memory: 'Memory error generating image', + unknown: 'Unknown error generating image', + }, inpaint: { support: 'This diffusion model may not support inpainting.', }, diff --git a/gui/src/strings/es.ts b/gui/src/strings/es.ts index aed1dee8..5ecf4eba 100644 --- a/gui/src/strings/es.ts +++ b/gui/src/strings/es.ts @@ -12,6 +12,10 @@ export const I18N_STRINGS_ES = { }, convert: '', error: { + image: { + memory: '', + unknown: '', + }, inpaint: { support: '', }, diff --git a/gui/src/strings/fr.ts b/gui/src/strings/fr.ts index 0cebf366..edbe267b 100644 --- a/gui/src/strings/fr.ts +++ b/gui/src/strings/fr.ts @@ -12,6 +12,10 @@ export const I18N_STRINGS_FR = { }, convert: '', error: { + image: { + memory: '', + unknown: '', + }, inpaint: { support: '', },