Skip to content

Commit 03f3d27

Browse files
committed
feat: 删除WebDAV同步验证状态文档和相关测试,优化错误处理逻辑
1 parent eef56df commit 03f3d27

4 files changed

Lines changed: 9 additions & 256 deletions

File tree

‎WEB_DAV_SYNC_VALIDATION_STATUS.md‎

Lines changed: 0 additions & 101 deletions
This file was deleted.

‎main.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {
1+
const {
22
app, BrowserWindow, ipcMain, Tray, Menu,
33
globalShortcut, dialog, shell, powerSaveBlocker,
44
powerMonitor, nativeTheme, screen, TouchBar, Notification, nativeImage
@@ -417,8 +417,8 @@ function touchBarSolution(mode) {
417417

418418
//before quit
419419
app.on('before-quit', async (event) => {
420-
event.preventDefault();
421420
if (webDavSyncService != null && webDavSyncService.isExitFinalizing()) return;
421+
event.preventDefault();
422422
await requestAppExitWithGuard({
423423
source: 'before-quit',
424424
interactive: false,

‎test/webdav-sync.test.js‎

Lines changed: 0 additions & 148 deletions
This file was deleted.

‎webdav-sync.js‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function createWebDavError(userMessage, detail) {
2929
}
3030

3131
function toWebDavErrorPayload(error, fallbackMessage) {
32-
const message = (error && error.userMessage) || fallbackMessage;
32+
const message = (error && (error.userMessage || error.message)) || fallbackMessage;
3333
const detail = (error && error.detail) || '';
3434
return {
3535
ok: false,
@@ -967,7 +967,7 @@ function createWebDavSyncService(deps) {
967967
function validateWebDavSyncConfig() {
968968
let config = getWebDavSyncConfig();
969969
if (config.url === '' || config.username === '' || config.password === '' || config.remotePath === '') {
970-
throw new Error(i18n.__('webdav-sync-missing-config'));
970+
throw createWebDavError(i18n.__('webdav-sync-missing-config'));
971971
}
972972
return config;
973973
}
@@ -1389,11 +1389,13 @@ function createWebDavSyncService(deps) {
13891389
if (webDavAutoPushTimer) clearTimeout(webDavAutoPushTimer);
13901390
appendWebDavSyncLog('auto-push-scheduled', reason || 'unknown');
13911391
webDavAutoPushTimer = setTimeout(async function () {
1392-
await runWebDavSyncTestHook('watcher-delay', reason || 'unknown');
1393-
performAutoWebDavPush(reason).catch(function (e) {
1392+
try {
1393+
await runWebDavSyncTestHook('watcher-delay', reason || 'unknown');
1394+
await performAutoWebDavPush(reason);
1395+
} catch (e) {
13941396
console.log(e);
13951397
appendWebDavSyncLog('auto-push-timer-failed', e.detail || e.message || '');
1396-
});
1398+
}
13971399
}, 1500);
13981400
}
13991401

0 commit comments

Comments
 (0)