This commit is contained in:
kakkokari-gtyih 2024-09-07 01:11:37 +09:00
parent c90c32d62a
commit e612fbf831
2 changed files with 4 additions and 7 deletions

View File

@ -4,6 +4,7 @@
*/ */
import { permissions } from 'misskey-js'; import { permissions } from 'misskey-js';
import type { ApiErrorInput } from '@/server/api/error.js';
import type { KeyOf, Schema } from '@/misc/json-schema.js'; import type { KeyOf, Schema } from '@/misc/json-schema.js';
import * as ep___admin_abuseReport_notificationRecipient_list import * as ep___admin_abuseReport_notificationRecipient_list
@ -780,11 +781,7 @@ interface IEndpointMetaBase {
readonly tags?: ReadonlyArray<string>; readonly tags?: ReadonlyArray<string>;
readonly errors?: { readonly errors?: {
readonly [key: string]: { readonly [key: string]: ApiErrorInput;
readonly message: string;
readonly code: string;
readonly id: string;
};
}; };
readonly res?: Schema; readonly res?: Schema;

View File

@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only * 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 { export class ApiError extends Error {
public message: string; public message: string;
@ -13,7 +13,7 @@ export class ApiError extends Error {
public httpStatusCode?: number; public httpStatusCode?: number;
public info?: any; 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 = { if (err == null) err = {
message: 'Internal error occurred. Please contact us if the error persists.', message: 'Internal error occurred. Please contact us if the error persists.',
code: 'INTERNAL_ERROR', code: 'INTERNAL_ERROR',