From fc8393d555dc58bd80314df7367df3bf63b5670c Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Mon, 8 Oct 2012 15:46:52 -0500 Subject: [PATCH] alternative to throwing an object literal. create a real exception and extend it with the custom properties that less needs to satisfy its error generator. An alternative to the solution proposed in cloudhead/less.js#963 --- lib/less/parser.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/less/parser.js b/lib/less/parser.js index 6bb90cd6..7ceddd2e 100644 --- a/lib/less/parser.js +++ b/lib/less/parser.js @@ -193,7 +193,10 @@ less.Parser = function Parser(env) { } function error(msg, type) { - throw { index: i, type: type || 'Syntax', message: msg }; + var e = new Error(msg) + e.index = i + e.type = type || 'Syntax' + throw e } // Same as $(), but don't change the state of the parser,