]> khamidou — GitHub mirrors - electron.git/commitdiff
Only report "app invalid" error when app could not be loaded, fixes #294.
authorCheng Zhao <zcbenz@gmail.com>
Wed, 14 May 2014 08:27:40 +0000 (16:27 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 14 May 2014 08:27:40 +0000 (16:27 +0800)
atom/browser/default_app/main.js

index 514268ea007f21a2abf8efdef71959789f6534cc..b120fa3884377dbb6a37e8b038a5faedd7bfa170 100644 (file)
@@ -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']);