From a6b73bde6aebdf6671269396179777f1bf6dbfe8 Mon Sep 17 00:00:00 2001 From: fyears <1142836+fyears@users.noreply.github.com> Date: Sat, 13 Jan 2024 16:47:55 +0800 Subject: [PATCH] fix callback for dropbox --- src/main.ts | 6 ++---- src/remoteForDropbox.ts | 4 +++- src/settings.ts | 11 +++++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main.ts b/src/main.ts index 9e9d8ae..348f98b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -68,9 +68,7 @@ import { applyPresetRulesInplace } from "./presetRules"; import { applyLogWriterInplace, log } from "./moreOnLog"; import AggregateError from "aggregate-error"; -import { - exportVaultSyncPlansToFiles, -} from "./debugMode"; +import { exportVaultSyncPlansToFiles } from "./debugMode"; import { SizesConflictModal } from "./syncSizesConflictNotice"; import { compareVersion } from "./misc"; @@ -589,7 +587,7 @@ export default class RemotelySavePlugin extends Plugin { async (e: any) => { new Notice(t("protocol_dropbox_connect_fail")); new Notice(`${e}`); - return; + throw e; } ); diff --git a/src/remoteForDropbox.ts b/src/remoteForDropbox.ts index f8c2713..806e65d 100644 --- a/src/remoteForDropbox.ts +++ b/src/remoteForDropbox.ts @@ -231,7 +231,9 @@ export const sendAuthReq = async ( return resp2; } catch (e) { log.error(e); - await errorCallBack(e); + if (errorCallBack !== undefined) { + await errorCallBack(e); + } } }; diff --git a/src/settings.ts b/src/settings.ts index 58f641d..cc25acf 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -19,9 +19,7 @@ import { WebdavAuthType, WebdavDepthType, } from "./baseTypes"; -import { - exportVaultSyncPlansToFiles, -} from "./debugMode"; +import { exportVaultSyncPlansToFiles } from "./debugMode"; import { exportQrCodeUri } from "./importExport"; import { clearAllSyncMetaMapping, @@ -407,7 +405,12 @@ class DropboxAuthModal extends Modal { const authRes = await sendAuthReqDropbox( this.plugin.settings.dropbox.clientID, verifier, - authCode + authCode, + async (e: any) => { + new Notice(t("protocol_dropbox_connect_fail")); + new Notice(`${e}`); + throw e; + } ); const self = this; setConfigBySuccessfullAuthInplace(