diff --git a/src/features/migration/MigrationManager.ts b/src/features/migration/MigrationManager.ts index f16d8827..f9c44ffd 100644 --- a/src/features/migration/MigrationManager.ts +++ b/src/features/migration/MigrationManager.ts @@ -1189,7 +1189,7 @@ export class MigrationManager { const entry = entries[id]; if (!entry) { - return; + throw Error(t`Entry "${id}" not found`); } const { signal } = MigrationManager.getOrCreateAbortController(); @@ -1219,6 +1219,11 @@ export class MigrationManager { MigrationManager.migrateSingleEntry(id, migrateOptions, signal), ); } + + const sourceTitle = entry.sourceTitle ?? t`Unknown source`; + throw Error( + t`Entry "${entry.mangaTitle} (${entry.mangaId}; ${sourceTitle} (${entry.sourceId}))" in invalid state "${entry.status}"`, + ); } private static updateState(updater: (draft: MigrationState) => void): void { diff --git a/src/features/migration/components/migration-entry/MigrationDestinationEntry.tsx b/src/features/migration/components/migration-entry/MigrationDestinationEntry.tsx index 3004fe7b..7794a3c3 100644 --- a/src/features/migration/components/migration-entry/MigrationDestinationEntry.tsx +++ b/src/features/migration/components/migration-entry/MigrationDestinationEntry.tsx @@ -15,7 +15,7 @@ import { MigrationEntryCardContent } from '@/features/migration/components/migra import { ENTRY_STATUS_TRANSLATION } from '@/features/migration/Migration.constants.ts'; import { AppRoutes } from '@/base/AppRoute.constants.ts'; import { MigrationManager } from '@/features/migration/MigrationManager.ts'; -import { extractGraphqlExceptionInfo } from '@/lib/HelperFunctions.ts'; +import { extractGraphqlExceptionInfo, getErrorMessage } from '@/lib/HelperFunctions.ts'; import { Confirmation } from '@/base/AppAwaitableComponent.ts'; import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts'; import { TypographyMaxLines } from '@/base/components/texts/TypographyMaxLines.tsx'; @@ -35,6 +35,7 @@ import { Link as RouterLink } from 'react-router-dom'; import { useTheme } from '@mui/material/styles'; import { applyStyles } from '@/base/utils/ApplyStyles.ts'; import { MigrationEntryThumbnail } from '@/features/migration/components/migration-entry/MigrationEntryThumbnail.tsx'; +import { makeToast } from '@/base/utils/Toast.ts'; const EntryStatus = ({ sourceMangaId, @@ -135,7 +136,9 @@ const EntryError = ({ color="error" startIcon={} onClick={() => - MigrationManager.retryEntry(id).catch(defaultPromiseErrorHandler('MigrationEntryRow::retry')) + MigrationManager.retryEntry(id).catch((e) => + makeToast(t`Could not retry "${title}"`, 'error', getErrorMessage(e)), + ) } > {t`Retry`} diff --git a/src/i18n/locales/en.po b/src/i18n/locales/en.po index de1db808..625c91f5 100644 --- a/src/i18n/locales/en.po +++ b/src/i18n/locales/en.po @@ -1101,6 +1101,10 @@ msgstr "Could not remove the download from the queue." msgid "Could not restore backup" msgstr "Could not restore backup" +#: src/features/migration/components/migration-entry/MigrationDestinationEntry.tsx +msgid "Could not retry \"{title}\"" +msgstr "Could not retry \"{title}\"" + #: src/features/chapter/components/buttons/ChapterDownloadRetryButton.tsx msgid "Could not retry failed download." msgstr "Could not retry failed download." @@ -1539,6 +1543,18 @@ msgstr "Entries in excluded categories will not be downloaded even if they are a msgid "Entries in excluded categories will not be updated even if they are also in included categories" msgstr "Entries in excluded categories will not be updated even if they are also in included categories" +#. placeholder {0}: entry.mangaTitle +#. placeholder {1}: entry.mangaId +#. placeholder {2}: entry.sourceId +#. placeholder {3}: entry.status +#: src/features/migration/MigrationManager.ts +msgid "Entry \"{0} ({1}; {sourceTitle} ({2}))\" in invalid state \"{3}\"" +msgstr "Entry \"{0} ({1}; {sourceTitle} ({2}))\" in invalid state \"{3}\"" + +#: src/features/migration/MigrationManager.ts +msgid "Entry \"{id}\" not found" +msgstr "Entry \"{id}\" not found" + #: src/base/components/downloads/DownloadStateIndicator.tsx #: src/base/components/feedback/SnackbarWithDescription.tsx msgid "Error" @@ -3770,6 +3786,10 @@ msgstr "Uninstalling" msgid "Unknown" msgstr "Unknown" +#: src/features/migration/MigrationManager.ts +msgid "Unknown source" +msgstr "Unknown source" + #: src/features/browse/sources/components/SourceCard.tsx msgid "Unpin source" msgstr "Unpin source"