Fixed: tcyun error notice

This commit is contained in:
Molunerfinn 2018-07-07 00:28:37 +08:00
parent 5207326017
commit 1faf29732c

View File

@ -140,14 +140,24 @@ const tcYunUpload = async (img, type, webContents) => {
webContents.send('uploadProgress', 100) webContents.send('uploadProgress', 100)
return imgList return imgList
} catch (err) { } catch (err) {
const body = JSON.parse(err.error) const options = db.read().get('picBed.tcyun').value()
webContents.send('uploadProgress', -1) let body
if (!options.version || options.version === 'v4') {
body = JSON.parse(err.error)
const notification = new Notification({ const notification = new Notification({
title: '上传失败!', title: '上传失败!',
body: `错误码:${body.code},请打开浏览器粘贴地址查看相关原因。` body: `错误码:${body.code},请打开浏览器粘贴地址查看相关原因。`
}) })
notification.show() notification.show()
clipboard.writeText('https://cloud.tencent.com/document/product/436/8432') clipboard.writeText('https://cloud.tencent.com/document/product/436/8432')
} else {
const notification = new Notification({
title: '上传失败!',
body: `请检查你的配置项是否正确`
})
notification.show()
}
webContents.send('uploadProgress', -1)
throw new Error(err) throw new Error(err)
} }
} }