From a3e1ed79ffe155017d745bb368ef319ede99dcf5 Mon Sep 17 00:00:00 2001 From: David Glasser Date: Fri, 8 Aug 2014 10:30:22 -0700 Subject: [PATCH] Print something better than [Object object] If we ever load javascript (uniload load or package.js parse) outside of a buildmessage job and there's a syntax error, FancySyntaxError gets thrown instead of properly processed. Now, we shouldn't do that (we should only load JS inside a buildmessage job!) but our codebase isn't currently up to that standard, so at least ensure that there's some level of useful syntax error (albeit with an ugly internal stack trace attached) in this case. --- tools/buildmessage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/buildmessage.js b/tools/buildmessage.js index 863bdde618..2c5939dc2d 100644 --- a/tools/buildmessage.js +++ b/tools/buildmessage.js @@ -325,8 +325,8 @@ var exception = function (error) { // XXX this may be the wrong place to do this, but it makes syntax errors in // files loaded via unipackage.load have context. if (error instanceof files.FancySyntaxError) { - error.message = "Syntax error: " + error.message + " at " + - error.file + ":" + error.line + ":" + error.column; + error = new Error("Syntax error: " + error.message + " at " + + error.file + ":" + error.line + ":" + error.column); } throw error; }