From dee5225ef90c75792716abed8dde7c4a4554368b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Tue, 23 Apr 2024 17:03:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=9F=A5=E6=9B=B4=E6=96=B0=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E6=97=B6=EF=BC=8C=E8=BF=94=E5=9B=9E=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/gui/src/bridge/update/backend.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/gui/src/bridge/update/backend.js b/packages/gui/src/bridge/update/backend.js index 5354e1b..7814f8f 100644 --- a/packages/gui/src/bridge/update/backend.js +++ b/packages/gui/src/bridge/update/backend.js @@ -83,13 +83,13 @@ function updateHandle (app, api, win, beforeQuit, quit, log) { if (error) { log.error('检查更新失败:', error) const errorMsg = '检查更新失败:' + error - win.webContents.send('update', { key: 'error', error: errorMsg }) + win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: errorMsg }) return } if (response && response.statusCode === 200) { if (body == null || body.length < 2) { log.warn('检查更新失败,github API返回数据为空:', body) - win.webContents.send('update', { key: 'error', error: '检查更新失败,github 返回数据为空' }) + win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: '检查更新失败,github 返回数据为空' }) return } @@ -98,13 +98,14 @@ function updateHandle (app, api, win, beforeQuit, quit, log) { try { data = JSON.parse(body) } catch (e) { - log.error(`检查更新失败,github API返回数据格式不正确, url: ${releasesApiUrl}, body: ${body}`) - win.webContents.send('update', { key: 'error', error: '检查更新失败,github API返回数据格式不正确' }) + log.error('检查更新失败,github API返回数据格式不正确:', body) + win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: '检查更新失败,github API返回数据格式不正确' }) return } if (typeof data !== 'object' || data.length === undefined) { - win.webContents.send('update', { key: 'error', error: '检查更新失败,github API返回数据格式不正确' }) + log.error('检查更新失败,github API返回数据不是数组:', body) + win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: '检查更新失败,github API返回数据不是数组' }) return }