From a15299ae53e0c791d975b30e7091dd6fa0dd1153 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 18 Oct 2020 10:21:02 +0900 Subject: [PATCH] Improve api error dialog --- src/client/os.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client/os.ts b/src/client/os.ts index 688bc136df..49f4d11ad2 100644 --- a/src/client/os.ts +++ b/src/client/os.ts @@ -70,7 +70,12 @@ export function apiWithDialog( onFailure?: (e: Error) => void, ) { const promise = api(endpoint, data, token); - promiseDialog(promise, onSuccess, onFailure); + promiseDialog(promise, onSuccess, onFailure ? onFailure : (e) => { + dialog({ + type: 'error', + text: e.message + '\n' + (e as any).id, + }); + }); return promise; }