diff --git a/web/src/lib/services/album.service.ts b/web/src/lib/services/album.service.ts index e0420f4341..6ccd67584e 100644 --- a/web/src/lib/services/album.service.ts +++ b/web/src/lib/services/album.service.ts @@ -273,7 +273,7 @@ export const handleDeleteAlbum = async (album: AlbumResponseDto, options?: { pro } return true; } catch (error) { - handleError(error, $t('errors.unable_to_delete_album')); + handleError(error, $t('errors.unable_to_delete_album'), { notify }); return false; } }; diff --git a/web/src/lib/utils/handle-error.ts b/web/src/lib/utils/handle-error.ts index 4ff35510c6..0817ab70e9 100644 --- a/web/src/lib/utils/handle-error.ts +++ b/web/src/lib/utils/handle-error.ts @@ -23,7 +23,8 @@ export function standardizeError(error: unknown) { return error instanceof Error ? error : new Error(String(error)); } -export function handleError(error: unknown, localizedMessage: string) { +export function handleError(error: unknown, localizedMessage: string, options?: { notify?: boolean }) { + const { notify = true } = options ?? {}; const standardizedError = standardizeError(error); if (standardizedError.name === 'AbortError') { return; @@ -39,7 +40,9 @@ export function handleError(error: unknown, localizedMessage: string) { const errorMessage = serverMessage || localizedMessage; - toastManager.danger(errorMessage); + if (notify) { + toastManager.danger(errorMessage); + } return errorMessage; } catch (error) {