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
This commit is contained in:
Charles Lowell
2012-10-08 15:46:52 -05:00
committed by Luke Page
parent 68297d7e38
commit fc8393d555

View File

@@ -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,