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.
This commit is contained in:
David Glasser
2014-08-08 10:30:22 -07:00
parent 4d1f7b58d0
commit a3e1ed79ff

View File

@@ -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;
}