1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Don't assume errors have stacks associated with them

This commit is contained in:
Nick O'Leary 2014-09-20 21:28:44 +01:00
parent f939d52551
commit e2be5c6383

18
red.js
View File

@ -171,7 +171,11 @@ RED.start().then(function() {
util.log('[red] Error: port in use');
} else {
util.log('[red] Uncaught Exception:');
util.log(err.stack);
if (err.stack) {
util.log(err.stack);
} else {
util.log(err);
}
}
process.exit(1);
});
@ -187,13 +191,21 @@ RED.start().then(function() {
}
}).otherwise(function(err) {
util.log("[red] Failed to start server:");
util.log(err.stack);
if (err.stack) {
util.log(err.stack);
} else {
util.log(err);
}
});
process.on('uncaughtException',function(err) {
util.log('[red] Uncaught Exception:');
util.log(err.stack);
if (err.stack) {
util.log(err.stack);
} else {
util.log(err);
}
process.exit(1);
});