From e2be5c6383147bb608a1ea34df0da31c9f531ba0 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sat, 20 Sep 2014 21:28:44 +0100 Subject: [PATCH] Don't assume errors have stacks associated with them --- red.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/red.js b/red.js index b6c6d5d79..2cb6c69fc 100644 --- a/red.js +++ b/red.js @@ -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); });