From cfeb00e629c90604d62665b28d40cd42d72bd56b Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 14 May 2014 16:27:40 +0800 Subject: [PATCH] Only report "app invalid" error when app could not be loaded, fixes #294. --- atom/browser/default_app/main.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/atom/browser/default_app/main.js b/atom/browser/default_app/main.js index 514268e..b120fa3 100644 --- a/atom/browser/default_app/main.js +++ b/atom/browser/default_app/main.js @@ -17,15 +17,20 @@ if (argv._.length > 0) { try { require(path.resolve(argv._[0])); } catch(e) { - app.focus(); - 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); + if (e.code == 'MODULE_NOT_FOUND') { + app.focus(); + 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); + } else { + console.error('App throwed an error when running', e); + throw e; + } } } else if (argv.version) { console.log('v' + process.versions['atom-shell']); -- 2.7.4