fix circular dependency caused by is-retryable-error, render-inline-error, and render-full-error
This commit is contained in:
parent
c2f6f54f50
commit
5f6578c8cd
6 changed files with 20 additions and 17 deletions
|
|
@ -3,7 +3,15 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { CaptchaErrorCode } from '@/core/CaptchaService.js';
|
||||
export const captchaErrorCodes = {
|
||||
invalidProvider: Symbol('invalidProvider'),
|
||||
invalidParameters: Symbol('invalidParameters'),
|
||||
noResponseProvided: Symbol('noResponseProvided'),
|
||||
requestFailed: Symbol('requestFailed'),
|
||||
verificationFailed: Symbol('verificationFailed'),
|
||||
unknown: Symbol('unknown'),
|
||||
} as const;
|
||||
export type CaptchaErrorCode = typeof captchaErrorCodes[keyof typeof captchaErrorCodes];
|
||||
|
||||
export class CaptchaError extends Error {
|
||||
public readonly code: CaptchaErrorCode;
|
||||
|
|
|
|||
6
packages/backend/src/misc/errors/ConflictError.ts
Normal file
6
packages/backend/src/misc/errors/ConflictError.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
export class ConflictError extends Error {}
|
||||
|
|
@ -7,9 +7,9 @@ import { AbortError, FetchError } from 'node-fetch';
|
|||
import { UnrecoverableError } from 'bullmq';
|
||||
import { StatusError } from '@/misc/status-error.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { CaptchaError, captchaErrorCodes } from '@/core/CaptchaService.js';
|
||||
import { CaptchaError, captchaErrorCodes } from '@/misc/captcha-error.js';
|
||||
import { FastifyReplyError } from '@/misc/fastify-reply-error.js';
|
||||
import { ConflictError } from '@/server/SkRateLimiterService.js';
|
||||
import { ConflictError } from '@/misc/errors/ConflictError.js';
|
||||
|
||||
/**
|
||||
* Returns false if the provided value represents a "permanent" error that cannot be retried.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { AbortError, FetchError } from 'node-fetch';
|
|||
import { StatusError } from '@/misc/status-error.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { renderInlineError } from '@/misc/render-inline-error.js';
|
||||
import { CaptchaError, captchaErrorCodes } from '@/core/CaptchaService.js';
|
||||
import { CaptchaError, captchaErrorCodes } from '@/misc/captcha-error.js';
|
||||
|
||||
export function renderFullError(e?: unknown): unknown {
|
||||
if (e === undefined) return 'undefined';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue