Merge pull request #2749 from balena-io/remove-double-error-message

Remove double error message
This commit is contained in:
Alexis Svinartchouk 2019-04-24 13:58:38 +02:00 committed by GitHub
commit 294ef8045a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 8 deletions

View File

@ -200,8 +200,7 @@ exports.performWrite = (image, drives, onProgress) => {
imagePath: image, imagePath: image,
destinations: drives, destinations: drives,
validateWriteOnSuccess: settings.get('validateWriteOnSuccess'), validateWriteOnSuccess: settings.get('validateWriteOnSuccess'),
unmountOnSuccess: settings.get('unmountOnSuccess'), unmountOnSuccess: settings.get('unmountOnSuccess')
checksumAlgorithms: [ 'xxhash' ]
}) })
}) })
@ -259,14 +258,14 @@ exports.performWrite = (image, drives, onProgress) => {
}) })
} }
return resolve(flashResults) resolve(flashResults)
}).catch((error) => { }).catch((error) => {
// This happens when the child is killed using SIGKILL // This happens when the child is killed using SIGKILL
const SIGKILL_EXIT_CODE = 137 const SIGKILL_EXIT_CODE = 137
if (error.code === SIGKILL_EXIT_CODE) { if (error.code === SIGKILL_EXIT_CODE) {
error.code = 'ECHILDDIED' error.code = 'ECHILDDIED'
} }
return reject(error) reject(error)
}).finally(() => { }).finally(() => {
console.log('Terminating IPC server') console.log('Terminating IPC server')
terminateServer() terminateServer()

View File

@ -22,7 +22,7 @@ const flashState = require('../../../models/flash-state')
const driveScanner = require('../../../modules/drive-scanner') const driveScanner = require('../../../modules/drive-scanner')
const progressStatus = require('../../../modules/progress-status') const progressStatus = require('../../../modules/progress-status')
const notification = require('../../../os/notification') const notification = require('../../../os/notification')
const exceptionReporter = require('../../../modules/exception-reporter') const analytics = require('../../../modules/analytics')
const imageWriter = require('../../../modules/image-writer') const imageWriter = require('../../../modules/image-writer')
const path = require('path') const path = require('path')
const store = require('../../../models/store') const store = require('../../../models/store')
@ -145,12 +145,13 @@ module.exports = function (
driveScanner.stop() driveScanner.stop()
const iconPath = '../../../assets/icon.png' const iconPath = '../../../assets/icon.png'
const basename = path.basename(image.path)
try { try {
await imageWriter.flash(image.path, drives) await imageWriter.flash(image.path, drives)
if (!flashState.wasLastFlashCancelled()) { if (!flashState.wasLastFlashCancelled()) {
const flashResults = flashState.getFlashResults() const flashResults = flashState.getFlashResults()
notification.send('Flash complete!', { 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 icon: iconPath
}) })
$state.go('success') $state.go('success')
@ -181,7 +182,8 @@ module.exports = function (
FlashErrorModalService.show(messages.error.childWriterDied()) FlashErrorModalService.show(messages.error.childWriterDied())
} else { } else {
FlashErrorModalService.show(messages.error.genericFlashError()) FlashErrorModalService.show(messages.error.genericFlashError())
exceptionReporter.report(error) error.image = basename
analytics.logException(error)
} }
} finally { } finally {
availableDrives.setDrives([]) availableDrives.setDrives([])

View File

@ -171,7 +171,7 @@ module.exports = {
}, },
genericFlashError: () => { 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: () => { validation: () => {