Show error message box when failed to save file

For #390
This commit is contained in:
Yuya Ochiai
2017-04-27 23:33:20 +09:00
parent 95c574eadc
commit 4c30d23ce9
2 changed files with 5 additions and 1 deletions

View File

@@ -327,6 +327,10 @@ allowProtocolDialog.init(mainWindow);
ipcMain.on('download-url', (event, URL) => {
downloadURL(mainWindow, URL, (err) => {
if (err) {
dialog.showMessageBox(mainWindow, {
type: 'error',
message: err.toString()
});
console.log(err);
}
});

View File

@@ -35,7 +35,7 @@ function getAttachmentName(headers) {
function saveResponseBody(response, filename, callback) {
const output = fs.createWriteStream(filename);
output.on('close', callback).on('error', callback);
output.on('close', callback);
switch (response.headers['content-encoding']) {
case 'gzip':
response.pipe(zlib.createGunzip()).pipe(output).on('error', callback);