diff --git a/lib/cli/etcher.js b/lib/cli/etcher.js
index edd0a2d2..15e28f88 100644
--- a/lib/cli/etcher.js
+++ b/lib/cli/etcher.js
@@ -65,7 +65,7 @@ form.run([
});
if (!selectedDrive) {
- throw new Error(`Drive not found: ${selectedDrive}`);
+ throw new Error(`Drive not found: ${answers.drive}`);
}
return writer.writeImage(options._[0], selectedDrive, {
@@ -120,7 +120,8 @@ form.run([
log.toStderr(JSON.stringify({
command: 'error',
data: {
- message: error.message
+ message: error.message,
+ code: error.code
}
}));
} else {
diff --git a/lib/cli/writer.js b/lib/cli/writer.js
index 8bff86e1..74a44d82 100644
--- a/lib/cli/writer.js
+++ b/lib/cli/writer.js
@@ -58,9 +58,8 @@ exports.writeImage = (imagePath, drive, options, onProgress) => {
return umount.umountAsync(drive.device).then(() => {
return imageStream.getFromFilePath(imagePath);
}).then((image) => {
- return imageWrite.write(drive.device, image.stream, {
+ return imageWrite.write(drive, image, {
check: options.validateWriteOnSuccess,
- size: image.size,
transform: image.transform
});
}).then((writer) => {
diff --git a/lib/gui/app.js b/lib/gui/app.js
index c598b0ba..0e1bdd13 100644
--- a/lib/gui/app.js
+++ b/lib/gui/app.js
@@ -156,6 +156,14 @@ app.controller('AppController', function(
this.tooltipModal = TooltipModalService;
this.handleError = (error) => {
+
+ // This particular error is handled by the alert ribbon
+ // on the main application page.
+ if (error.code === 'ENOSPC') {
+ AnalyticsService.logEvent('Drive ran out of space');
+ return;
+ }
+
OSDialogService.showError(error);
// Also throw it so it gets displayed in DevTools
diff --git a/lib/gui/models/store.js b/lib/gui/models/store.js
index 29bb3215..fd1923f1 100644
--- a/lib/gui/models/store.js
+++ b/lib/gui/models/store.js
@@ -206,6 +206,10 @@ const storeReducer = (state, action) => {
throw new Error(`Invalid results sourceChecksum: ${action.data.sourceChecksum}`);
}
+ if (action.data.errorCode && !_.isString(action.data.errorCode)) {
+ throw new Error(`Invalid results errorCode: ${action.data.errorCode}`);
+ }
+
return state
.set('isFlashing', false)
.set('flashResults', Immutable.fromJS(action.data))
diff --git a/lib/gui/modules/image-writer.js b/lib/gui/modules/image-writer.js
index 3cb32816..c356a492 100644
--- a/lib/gui/modules/image-writer.js
+++ b/lib/gui/modules/image-writer.js
@@ -252,7 +252,8 @@ imageWriter.service('ImageWriterService', function($q, $timeout, SettingsModel)
}).catch((error) => {
this.unsetFlashingFlag({
cancelled: false,
- passedValidation: false
+ passedValidation: false,
+ errorCode: error.code
});
return $q.reject(error);
diff --git a/lib/gui/partials/main.html b/lib/gui/partials/main.html
index bcca9434..19c02a33 100644
--- a/lib/gui/partials/main.html
+++ b/lib/gui/partials/main.html
@@ -98,10 +98,13 @@
-
+
+ Not enough space on the drive. Please insert larger one and
+
+
Your removable drive did not pass validation check. Please insert another one and
-
+
Oops, seems something went wrong. Click to retry