Merge branch 'master' into jviotti/feat/41/burn-again

This commit is contained in:
Juan Cruz Viotti 2015-12-01 10:41:12 -04:00
commit 739a191e66
4 changed files with 30 additions and 6 deletions

View File

@ -87,7 +87,7 @@ app.controller('AppController', function($q, DriveScannerService, SelectionState
console.debug('Burning ' + image + ' to ' + drive.device);
return self.writer.burn(image, drive).then(function() {
console.debug('Done!');
});
}).catch(dialog.showError);
};
this.open = shell.openExternal;
@ -127,9 +127,13 @@ var _ = require('lodash');
var remote = window.require('remote');
if (window.mocha) {
var drives = remote.require(require('path').join(__dirname, '..', '..', 'src', 'drives'));
var path = require('path');
var srcPath = path.join(__dirname, '..', '..', 'src');
var drives = remote.require(path.join(srcPath, 'drives'));
var dialog = remote.require(path.join(srcPath, 'dialog'));
} else {
var drives = remote.require('./src/drives');
var dialog = remote.require('./src/dialog');
}
var driveScanner = angular.module('herostratus.drive-scanner', []);
@ -235,7 +239,7 @@ driveScanner.service('DriveScannerService', function($q, DriveScannerRefreshServ
* });
*/
this.scan = function() {
return $q.when(drives.listRemovable());
return $q.when(drives.listRemovable()).catch(dialog.showError);
};
/**

View File

@ -86,7 +86,7 @@ app.controller('AppController', function($q, DriveScannerService, SelectionState
console.debug('Burning ' + image + ' to ' + drive.device);
return self.writer.burn(image, drive).then(function() {
console.debug('Done!');
});
}).catch(dialog.showError);
};
this.open = shell.openExternal;

View File

@ -30,9 +30,13 @@ var _ = require('lodash');
var remote = window.require('remote');
if (window.mocha) {
var drives = remote.require(require('path').join(__dirname, '..', '..', 'src', 'drives'));
var path = require('path');
var srcPath = path.join(__dirname, '..', '..', 'src');
var drives = remote.require(path.join(srcPath, 'drives'));
var dialog = remote.require(path.join(srcPath, 'dialog'));
} else {
var drives = remote.require('./src/drives');
var dialog = remote.require('./src/dialog');
}
var driveScanner = angular.module('herostratus.drive-scanner', []);
@ -138,7 +142,7 @@ driveScanner.service('DriveScannerService', function($q, DriveScannerRefreshServ
* });
*/
this.scan = function() {
return $q.when(drives.listRemovable());
return $q.when(drives.listRemovable()).catch(dialog.showError);
};
/**

View File

@ -55,3 +55,19 @@ exports.selectImage = function() {
});
});
};
/**
* @summary Show error dialog for an Error instance
* @function
* @public
*
* @param {Error} error - error
*
* @example
* dialog.showError(new Error('Foo Bar'));
*/
exports.showError = function(error) {
'use strict';
dialog.showErrorBox(error.message, error.stack || '');
};