Use dialog to report invalid app.

This commit is contained in:
Cheng Zhao 2014-05-05 16:35:06 +08:00
parent 84bf956725
commit c6448d0607

View file

@ -1,4 +1,5 @@
var app = require('app'); var app = require('app');
var dialog = require('dialog');
var path = require('path'); var path = require('path');
var optimist = require('optimist'); var optimist = require('optimist');
@ -17,8 +18,14 @@ if (argv._.length > 0) {
require(path.resolve(argv._[0])); require(path.resolve(argv._[0]));
} catch(e) { } catch(e) {
if (e.code == 'MODULE_NOT_FOUND') { if (e.code == 'MODULE_NOT_FOUND') {
console.error(e.stack); app.focus();
console.error('Specified app is invalid'); dialog.showMessageBox({
type: 'warning',
buttons: ['OK'],
title: 'Error opening app',
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 { } else {
throw e; throw e;