Only report "app invalid" error when app could not be loaded, fixes #294.

This commit is contained in:
Cheng Zhao 2014-05-14 16:27:40 +08:00
parent e415c66f68
commit cfeb00e629

View file

@ -17,15 +17,20 @@ if (argv._.length > 0) {
try { try {
require(path.resolve(argv._[0])); require(path.resolve(argv._[0]));
} catch(e) { } catch(e) {
app.focus(); if (e.code == 'MODULE_NOT_FOUND') {
dialog.showMessageBox({ app.focus();
type: 'warning', dialog.showMessageBox({
buttons: ['OK'], type: 'warning',
title: 'Error opening app', buttons: ['OK'],
message: 'The app provided is not a valid atom-shell app, please read the docs on how to write one:', title: 'Error opening app',
detail: 'https://github.com/atom/atom-shell/tree/master/docs' message: 'The app provided is not a valid atom-shell app, please read the docs on how to write one:',
}); detail: 'https://github.com/atom/atom-shell/tree/master/docs'
process.exit(1); });
process.exit(1);
} else {
console.error('App throwed an error when running', e);
throw e;
}
} }
} else if (argv.version) { } else if (argv.version) {
console.log('v' + process.versions['atom-shell']); console.log('v' + process.versions['atom-shell']);