From f7c4cee404e17b3ed201e005185a5041009d0e6f Mon Sep 17 00:00:00 2001 From: Gergo Moricz Date: Fri, 13 Sep 2024 14:02:49 +0200 Subject: [PATCH] fix(queue-worker): don't send LLM extract hallucination error to Sentry --- apps/api/src/services/queue-worker.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/api/src/services/queue-worker.ts b/apps/api/src/services/queue-worker.ts index ad0e4ad5..37e14baf 100644 --- a/apps/api/src/services/queue-worker.ts +++ b/apps/api/src/services/queue-worker.ts @@ -448,11 +448,13 @@ async function processJob(job: Job, token: string) { } catch (error) { Logger.error(`🐂 Job errored ${job.id} - ${error}`); - Sentry.captureException(error, { - data: { - job: job.id, - }, - }); + if (!(error instanceof Error && error.message.includes("JSON parsing error(s): "))) { + Sentry.captureException(error, { + data: { + job: job.id, + }, + }); + } if (error instanceof CustomError) { // Here we handle the error, then save the failed job