From 63c047009f6d3b8d20ef291bc4ce036c48aaf03b Mon Sep 17 00:00:00 2001 From: Alexis Svinartchouk Date: Mon, 22 Apr 2019 18:24:50 +0200 Subject: [PATCH 1/2] Remove useless returns and unused parameter Change-type: patch --- lib/gui/app/modules/image-writer.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/gui/app/modules/image-writer.js b/lib/gui/app/modules/image-writer.js index 8d74f0c4..6ea21e4a 100644 --- a/lib/gui/app/modules/image-writer.js +++ b/lib/gui/app/modules/image-writer.js @@ -200,8 +200,7 @@ exports.performWrite = (image, drives, onProgress) => { imagePath: image, destinations: drives, validateWriteOnSuccess: settings.get('validateWriteOnSuccess'), - unmountOnSuccess: settings.get('unmountOnSuccess'), - checksumAlgorithms: [ 'xxhash' ] + unmountOnSuccess: settings.get('unmountOnSuccess') }) }) @@ -259,14 +258,14 @@ exports.performWrite = (image, drives, onProgress) => { }) } - return resolve(flashResults) + resolve(flashResults) }).catch((error) => { // This happens when the child is killed using SIGKILL const SIGKILL_EXIT_CODE = 137 if (error.code === SIGKILL_EXIT_CODE) { error.code = 'ECHILDDIED' } - return reject(error) + reject(error) }).finally(() => { console.log('Terminating IPC server') terminateServer() From 1f7e4c886b4f85579a53f96f3039ec38097d673d Mon Sep 17 00:00:00 2001 From: Alexis Svinartchouk Date: Mon, 22 Apr 2019 18:25:26 +0200 Subject: [PATCH 2/2] Don't show a dialog when the write fails. There is already an error modal and the error detail will be shown in the console. Changelog-entry: Don't show a dialog when the write fails. --- lib/gui/app/pages/main/controllers/flash.js | 8 +++++--- lib/shared/messages.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/gui/app/pages/main/controllers/flash.js b/lib/gui/app/pages/main/controllers/flash.js index 64003f0c..d10bb065 100644 --- a/lib/gui/app/pages/main/controllers/flash.js +++ b/lib/gui/app/pages/main/controllers/flash.js @@ -22,7 +22,7 @@ const flashState = require('../../../models/flash-state') const driveScanner = require('../../../modules/drive-scanner') const progressStatus = require('../../../modules/progress-status') const notification = require('../../../os/notification') -const exceptionReporter = require('../../../modules/exception-reporter') +const analytics = require('../../../modules/analytics') const imageWriter = require('../../../modules/image-writer') const path = require('path') const store = require('../../../models/store') @@ -145,12 +145,13 @@ module.exports = function ( driveScanner.stop() const iconPath = '../../../assets/icon.png' + const basename = path.basename(image.path) try { await imageWriter.flash(image.path, drives) if (!flashState.wasLastFlashCancelled()) { const flashResults = flashState.getFlashResults() notification.send('Flash complete!', { - body: messages.info.flashComplete(path.basename(image.path), drives, flashResults.results.devices), + body: messages.info.flashComplete(basename, drives, flashResults.results.devices), icon: iconPath }) $state.go('success') @@ -181,7 +182,8 @@ module.exports = function ( FlashErrorModalService.show(messages.error.childWriterDied()) } else { FlashErrorModalService.show(messages.error.genericFlashError()) - exceptionReporter.report(error) + error.image = basename + analytics.logException(error) } } finally { availableDrives.setDrives([]) diff --git a/lib/shared/messages.js b/lib/shared/messages.js index 2112777d..6f0733b3 100644 --- a/lib/shared/messages.js +++ b/lib/shared/messages.js @@ -171,7 +171,7 @@ module.exports = { }, genericFlashError: () => { - return 'Oops, seems something went wrong.' + return 'Something went wrong. If it is a compressed image, please check that the archive is not corrupted.' }, validation: () => {