mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
improve "condensed line" error logging in QueueProcessorService.ts
This commit is contained in:
parent
82b7768ab2
commit
d53ff4097a
1 changed files with 15 additions and 1 deletions
|
@ -6,12 +6,14 @@
|
|||
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
||||
import * as Bull from 'bullmq';
|
||||
import * as Sentry from '@sentry/node';
|
||||
import { AbortError } from 'node-fetch';
|
||||
import type { Config } from '@/config.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type Logger from '@/logger.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { CheckModeratorsActivityProcessorService } from '@/queue/processors/CheckModeratorsActivityProcessorService.js';
|
||||
import { StatusError } from '@/misc/status-error.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { UserWebhookDeliverProcessorService } from './processors/UserWebhookDeliverProcessorService.js';
|
||||
import { SystemWebhookDeliverProcessorService } from './processors/SystemWebhookDeliverProcessorService.js';
|
||||
import { EndedPollNotificationProcessorService } from './processors/EndedPollNotificationProcessorService.js';
|
||||
|
@ -138,10 +140,22 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
|||
// 何故かeがundefinedで来ることがある
|
||||
if (!e) return '?';
|
||||
|
||||
if (e instanceof Bull.UnrecoverableError || e.name === 'AbortError' || e instanceof StatusError) {
|
||||
if (e instanceof Bull.UnrecoverableError || e instanceof AbortError || e.name === 'AbortError') {
|
||||
return `${e.name}: ${e.message}`;
|
||||
}
|
||||
|
||||
if (e instanceof StatusError) {
|
||||
if (e.statusMessage) {
|
||||
return `${e.name} ${e.statusCode}: ${e.statusMessage}`;
|
||||
} else {
|
||||
return `${e.name} ${e.statusCode}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (e instanceof IdentifiableError) {
|
||||
return `${e.name} ${e.id}: ${e.message}`;
|
||||
}
|
||||
|
||||
return {
|
||||
stack: e.stack,
|
||||
message: e.message,
|
||||
|
|
Loading…
Add table
Reference in a new issue