add renderInlineError to serialize errors in a consistent way
This commit is contained in:
parent
3808502f86
commit
61d0aeba2e
4 changed files with 42 additions and 36 deletions
|
|
@ -14,6 +14,7 @@ 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 { renderInlineError } from '@/misc/render-inline-error.js';
|
||||
import { UserWebhookDeliverProcessorService } from './processors/UserWebhookDeliverProcessorService.js';
|
||||
import { SystemWebhookDeliverProcessorService } from './processors/SystemWebhookDeliverProcessorService.js';
|
||||
import { EndedPollNotificationProcessorService } from './processors/EndedPollNotificationProcessorService.js';
|
||||
|
|
@ -140,20 +141,8 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
|||
// 何故かeがundefinedで来ることがある
|
||||
if (!e) return '?';
|
||||
|
||||
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}`;
|
||||
if (e instanceof Bull.UnrecoverableError || e instanceof AbortError || e.name === 'AbortError' || e instanceof StatusError || e instanceof IdentifiableError) {
|
||||
return renderInlineError(e);
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import type { Config } from '@/config.js';
|
|||
import { ApLogService, calculateDurationSince } from '@/core/ApLogService.js';
|
||||
import { UpdateInstanceQueue } from '@/core/UpdateInstanceQueue.js';
|
||||
import { isRetryableError } from '@/misc/is-retryable-error.js';
|
||||
import { renderInlineError } from '@/misc/render-inline-error.js';
|
||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||
import type { InboxJobData } from '../types.js';
|
||||
|
||||
|
|
@ -300,24 +301,8 @@ export class InboxProcessorService implements OnApplicationShutdown {
|
|||
}
|
||||
}
|
||||
|
||||
if (e instanceof StatusError && !e.isRetryable) {
|
||||
return `skip: permanent error ${e.statusCode}`;
|
||||
}
|
||||
|
||||
if (e instanceof IdentifiableError && !e.isRetryable) {
|
||||
if (e.message) {
|
||||
return `skip: permanent error ${e.id}: ${e.message}`;
|
||||
} else {
|
||||
return `skip: permanent error ${e.id}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isRetryableError(e)) {
|
||||
if (e instanceof Error) {
|
||||
return `skip: permanent error ${e.name}: ${e.message}`;
|
||||
} else {
|
||||
return `skip: permanent error ${e}`;
|
||||
}
|
||||
return `skip: permanent error ${renderInlineError(e)}`;
|
||||
}
|
||||
|
||||
throw e;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue