diff --git a/packages/frontend/src/os.ts b/packages/frontend/src/os.ts index 4eb4072b72..97e5e2b1ad 100644 --- a/packages/frontend/src/os.ts +++ b/packages/frontend/src/os.ts @@ -57,7 +57,10 @@ export function apiWithDialog< text = initialText.join('\n'); if ('code' in err && err.code != null) { - if (err.code === 'INTERNAL_ERROR') { + if (customErrors && customErrors[err.code] != null) { + title = customErrors[err.code].title; + text = customErrors[err.code].text; + } else if (err.code === 'INTERNAL_ERROR') { title = i18n.ts.internalServerError; text = i18n.ts.internalServerErrorDescription; const date = new Date().toISOString(); @@ -93,9 +96,6 @@ export function apiWithDialog< } else if (err.code === 'ROLE_PERMISSION_DENIED') { title = i18n.ts.permissionDeniedError; text = i18n.ts.permissionDeniedErrorDescription; - } else if (customErrors && customErrors[err.code] != null) { - title = customErrors[err.code].title; - text = customErrors[err.code].text; } else if (err.code.startsWith('TOO_MANY')) { title = i18n.ts.youCannotCreateAnymore; if ('id' in err && err.id != null) { diff --git a/packages/frontend/src/scripts/err-promise.ts b/packages/frontend/src/scripts/err-promise.ts index 2d334c3b43..24bed5b91b 100644 --- a/packages/frontend/src/scripts/err-promise.ts +++ b/packages/frontend/src/scripts/err-promise.ts @@ -3,14 +3,8 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -export interface IErrPromise { - then(onfulfilled?: ((value: TSuccess) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: TError) => TResult2 | PromiseLike) | undefined | null): Promise; - - catch(onrejected?: ((reason: TError) => TResult | PromiseLike) | undefined | null): Promise; -} - /** rejectに型付けができるPromise */ -export class ErrPromise extends Promise implements IErrPromise { +export class ErrPromise extends Promise { constructor(executor: (resolve: (value: TSuccess | PromiseLike) => void, reject: (reason: TError) => void) => void) { super(executor); }