From f62cd8941ced74a4865aa5eae4f4a1c7aa1d30f1 Mon Sep 17 00:00:00 2001 From: Hazel K Date: Tue, 8 Oct 2024 10:33:34 -0400 Subject: [PATCH] condense error info --- .../src/queue/QueueProcessorService.ts | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/packages/backend/src/queue/QueueProcessorService.ts b/packages/backend/src/queue/QueueProcessorService.ts index 5ae0c738b6..c22e8d90f1 100644 --- a/packages/backend/src/queue/QueueProcessorService.ts +++ b/packages/backend/src/queue/QueueProcessorService.ts @@ -127,29 +127,26 @@ export class QueueProcessorService implements OnApplicationShutdown { this.logger = this.queueLoggerService.logger; function renderError(e?: Error) { + // 何故かeがundefinedで来ることがある + if (!e) return '?'; + if (e instanceof Bull.UnrecoverableError) { return { - stack: undefined, message: e.message, name: 'Bull.UnrecoverableError', }; - } else if (e) { // 何故かeがundefinedで来ることがある - return { - stack: e.stack, - message: e.message, - name: e.name, - }; - } else { - return { - stack: '?', - message: '?', - name: '?', - }; } + + return { + stack: e.stack, + message: e.message, + name: e.name, + }; } function renderJob(job?: Bull.Job) { - if (!job) return 'N/A'; + if (!job) return '?'; + return { name: job.name, info: getJobInfo(job),