fix
This commit is contained in:
parent
38fb256957
commit
fa24a18ccd
|
@ -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) {
|
||||
|
|
|
@ -3,14 +3,8 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
export interface IErrPromise<TSuccess, TError = unknown> {
|
||||
then<TResult1 = TSuccess, TResult2 = never>(onfulfilled?: ((value: TSuccess) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: TError) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
||||
|
||||
catch<TResult = never>(onrejected?: ((reason: TError) => TResult | PromiseLike<TResult>) | undefined | null): Promise<TSuccess | TResult>;
|
||||
}
|
||||
|
||||
/** rejectに型付けができるPromise */
|
||||
export class ErrPromise<TSuccess, TError> extends Promise<TSuccess> implements IErrPromise<TSuccess, TError> {
|
||||
export class ErrPromise<TSuccess, TError> extends Promise<TSuccess> {
|
||||
constructor(executor: (resolve: (value: TSuccess | PromiseLike<TSuccess>) => void, reject: (reason: TError) => void) => void) {
|
||||
super(executor);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue