From: Cheng Zhao Date: Wed, 24 Jul 2013 07:20:59 +0000 (+0800) Subject: Do not end the process when other exception occurs. X-Git-Tag: v0.1.6~15 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=a7557a9626c59a63eb002e2ec108bcf3c1bca46a;p=electron.git Do not end the process when other exception occurs. --- diff --git a/browser/default_app/main.js b/browser/default_app/main.js index f5cc2973..fdf33882 100644 --- a/browser/default_app/main.js +++ b/browser/default_app/main.js @@ -5,11 +5,16 @@ var path = require('path'); // Start the specified app if there is one specified in command line, otherwise // start the default app. if (argv._.length > 0) { - process.on('uncaughtException', function() { - process.exit(1); - }); - - require(path.resolve(argv._[0])); + try { + require(path.resolve(argv._[0])); + } catch(e) { + if (e.code == 'MODULE_NOT_FOUND') { + console.error('Specified app is invalid'); + process.exit(1); + } else { + throw e; + } + } } else { require('./default_app.js'); }