From f2077dca04c2de341b015efc391025a59d0a9c6e Mon Sep 17 00:00:00 2001 From: lyswhut Date: Mon, 25 Nov 2019 11:44:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=95=B0=E6=8D=AE=E4=BC=A0?= =?UTF-8?q?=E8=BE=93=E7=BB=93=E6=9D=9F=E6=97=B6=E6=96=87=E4=BB=B6=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=AE=8C=E6=88=90=E6=83=85=E5=86=B5=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/utils/download/Downloader.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/renderer/utils/download/Downloader.js b/src/renderer/utils/download/Downloader.js index fbeda582..1127f180 100644 --- a/src/renderer/utils/download/Downloader.js +++ b/src/renderer/utils/download/Downloader.js @@ -126,7 +126,13 @@ class Task extends EventEmitter { response .on('data', this.__handleWriteData.bind(this)) .on('error', err => this.__handleError(err)) - .on('end', () => this.__handleComplete()) + .on('end', () => { + if (response.complete) { + this.__handleComplete() + } else { + this.__handleError(new Error('The connection was terminated while the message was still being sent')) + } + }) }) .on('error', err => this.__handleError(err)) .on('close', () => this.__closeWriteStream())