From e612fbf831c13dede8d3d723586cc319fa6c400e Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Sat, 7 Sep 2024 01:11:37 +0900 Subject: [PATCH] fix --- packages/backend/src/server/api/endpoints.ts | 7 ++----- packages/backend/src/server/api/error.ts | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) 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',