Handle target manga without chapters on migration
The server throws an error in case the source returns an empty chapter list. However, this is not an error and should not break/stop the migration
This commit is contained in:
@@ -506,6 +506,7 @@ export class Mangas {
|
||||
migrateChapters,
|
||||
migrateCategories,
|
||||
migrateTracking,
|
||||
apolloOptions: { errorPolicy: 'all' },
|
||||
}).response,
|
||||
getMetadataServerSettings(),
|
||||
]);
|
||||
@@ -514,13 +515,14 @@ export class Mangas {
|
||||
throw new Error('Mangas::migrate: missing manga data');
|
||||
}
|
||||
|
||||
if (
|
||||
migrateChapters &&
|
||||
(!mangaToMigrateData.manga.chapters || !mangaToMigrateToData.fetchChapters?.chapters)
|
||||
) {
|
||||
if (migrateChapters && !mangaToMigrateData.manga.chapters) {
|
||||
throw new Error('Mangas::migrate: missing chapters data');
|
||||
}
|
||||
|
||||
if (!mangaToMigrateToData.fetchChapters?.chapters) {
|
||||
mangaToMigrateToData.fetchChapters = { chapters: [] };
|
||||
}
|
||||
|
||||
const performMigrationAction = async (
|
||||
migrateAction: keyof MigrateFuncReturn,
|
||||
...actions: [boolean | undefined, MigrateFuncReturn][]
|
||||
|
||||
Reference in New Issue
Block a user