diff --git a/packages/backend/src/server/api/endpoints.ts b/packages/backend/src/server/api/endpoints.ts index 3dfb7fdad4..c4ce52a16b 100644 --- a/packages/backend/src/server/api/endpoints.ts +++ b/packages/backend/src/server/api/endpoints.ts @@ -4,6 +4,7 @@ */ import { permissions } from 'misskey-js'; +import type { ApiErrorInput } from '@/server/api/error.js'; import type { KeyOf, Schema } from '@/misc/json-schema.js'; import * as ep___admin_abuseReport_notificationRecipient_list @@ -780,11 +781,7 @@ interface IEndpointMetaBase { readonly tags?: ReadonlyArray; readonly errors?: { - readonly [key: string]: { - readonly message: string; - readonly code: string; - readonly id: string; - }; + readonly [key: string]: ApiErrorInput; }; readonly res?: Schema; diff --git a/packages/backend/src/server/api/error.ts b/packages/backend/src/server/api/error.ts index 2f8322a568..60dfdccfd4 100644 --- a/packages/backend/src/server/api/error.ts +++ b/packages/backend/src/server/api/error.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -type E = { message: string, code: string, id: string, kind?: 'client' | 'server' | 'permission', httpStatusCode?: number }; +export type ApiErrorInput = { message: string, code: string, id: string, kind?: 'client' | 'server' | 'permission', httpStatusCode?: number }; export class ApiError extends Error { public message: string; @@ -13,7 +13,7 @@ export class ApiError extends Error { public httpStatusCode?: number; public info?: any; - constructor(err?: E | null | undefined, info?: any | null | undefined) { + constructor(err?: ApiErrorInput | null | undefined, info?: any | null | undefined) { if (err == null) err = { message: 'Internal error occurred. Please contact us if the error persists.', code: 'INTERNAL_ERROR',