From 96f586900c160d60363206c9aa842b027c0feae3 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Thu, 20 Apr 2017 12:01:43 -0400 Subject: [PATCH] fix(GUI): catch EIO errors and display a user friendly message (#1318) If we get EIO at this point, then it means that the writer did everything it could to recover (like multiple retries), and the error is truly an input/output error coming from the operating system. In this commit, we show a nice user friendly message explaining what happened, and advising users to try again with another drive, reader, or port instead of showing an uncaught EIO error. Change-Type: patch Changelog-Entry: Show a friendly user message on EIO after many retries. Signed-off-by: Juan Cruz Viotti --- lib/gui/pages/main/controllers/flash.js | 6 ++++++ lib/shared/messages.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/lib/gui/pages/main/controllers/flash.js b/lib/gui/pages/main/controllers/flash.js index 5481e798..24b22ab0 100644 --- a/lib/gui/pages/main/controllers/flash.js +++ b/lib/gui/pages/main/controllers/flash.js @@ -97,6 +97,12 @@ module.exports = function( image, drive }); + } else if (error.code === 'EIO') { + FlashErrorModalService.show(messages.error.inputOutput()); + AnalyticsService.logEvent('Input/output error', { + image, + drive + }); } else if (error.code === 'ENOSPC') { FlashErrorModalService.show(messages.error.notEnoughSpaceInDrive()); AnalyticsService.logEvent('Out of space', { diff --git a/lib/shared/messages.js b/lib/shared/messages.js index bd6be0ca..c4353ae5 100644 --- a/lib/shared/messages.js +++ b/lib/shared/messages.js @@ -92,6 +92,12 @@ module.exports = { 'Looks like Etcher lost access to the drive.', 'Did it get unplugged accidentally?', '\n\nSometimes this error is caused by faulty readers that don\'t provide stable access to the drive.' + ].join(' ')), + + inputOutput: _.template([ + 'Looks like Etcher is not able to write to this location of the drive.', + 'This error is usually caused by a faulty drive, reader, or port.', + '\n\nPlease try again with another drive, reader, or port.' ].join(' ')) }