Show error toasts on migration retry failure
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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={<ReplayIcon />}
|
||||
onClick={() =>
|
||||
MigrationManager.retryEntry(id).catch(defaultPromiseErrorHandler('MigrationEntryRow::retry'))
|
||||
MigrationManager.retryEntry(id).catch((e) =>
|
||||
makeToast(t`Could not retry "${title}"`, 'error', getErrorMessage(e)),
|
||||
)
|
||||
}
|
||||
>
|
||||
{t`Retry`}
|
||||
|
||||
Reference in New Issue
Block a user