1
0
Fork 0

start adding specific error messages

This commit is contained in:
Sean Sube 2024-01-06 15:10:24 -06:00
parent 9b9a614f44
commit c7154ffb27
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
5 changed files with 28 additions and 4 deletions

View File

@ -52,9 +52,9 @@ export function ErrorCard(props: ErrorCardProps) {
sx={{ alignItems: 'center' }}
>
<Alert severity='error'>
{t('loading.progress', image.steps)}
{t('loading.progress', image)}
<br />
{getImageErrorReason(image)}
{t(getImageErrorReason(image))}
</Alert>
<Stack direction='row' spacing={2}>
<Tooltip title={t('tooltip.retry')}>
@ -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 '';
return `${IMAGE_ERROR}.${error}`;
}
return UNKNOWN_ERROR;
}

View File

@ -12,6 +12,10 @@ export const I18N_STRINGS_DE = {
},
convert: '',
error: {
image: {
memory: '',
unknown: '',
},
inpaint: {
support: '',
},

View File

@ -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.',
},

View File

@ -12,6 +12,10 @@ export const I18N_STRINGS_ES = {
},
convert: '',
error: {
image: {
memory: '',
unknown: '',
},
inpaint: {
support: '',
},

View File

@ -12,6 +12,10 @@ export const I18N_STRINGS_FR = {
},
convert: '',
error: {
image: {
memory: '',
unknown: '',
},
inpaint: {
support: '',
},