Do not end the process when other exception occurs.
This commit is contained in:
parent
85e4e99e7f
commit
a7557a9626
1 changed files with 10 additions and 5 deletions
|
@ -5,11 +5,16 @@ var path = require('path');
|
||||||
// Start the specified app if there is one specified in command line, otherwise
|
// Start the specified app if there is one specified in command line, otherwise
|
||||||
// start the default app.
|
// start the default app.
|
||||||
if (argv._.length > 0) {
|
if (argv._.length > 0) {
|
||||||
process.on('uncaughtException', function() {
|
try {
|
||||||
process.exit(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
require(path.resolve(argv._[0]));
|
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 {
|
} else {
|
||||||
require('./default_app.js');
|
require('./default_app.js');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue