From 4181bee43c527e3417d64ac0b8c1af211da32b7b Mon Sep 17 00:00:00 2001 From: cutestnekoaqua Date: Wed, 29 Mar 2023 21:25:28 +0200 Subject: [PATCH] catch text parsing error --- packages/backend/src/queue/processors/db/import-posts.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/queue/processors/db/import-posts.ts b/packages/backend/src/queue/processors/db/import-posts.ts index f1e1a232f..f4948269c 100644 --- a/packages/backend/src/queue/processors/db/import-posts.ts +++ b/packages/backend/src/queue/processors/db/import-posts.ts @@ -92,7 +92,13 @@ export async function importPosts( logger.info(`Is dm, skip [${linenum}] ...`); continue; } - const text = htmlToMfm(post.content, post.tag); + let text; + try { + text = htmlToMfm(post.content, post.tag); + } catch (e) { + logger.warn(`Error while parsing text in line ${linenum}: ${e}`); + continue; + } logger.info(`Posting[${linenum}] ...`); const note = await create(user, {