mirror of
https://github.com/less/less.js.git
synced 2026-02-03 11:35:08 -05:00
catch errors on css function calls
This commit is contained in:
@@ -3,9 +3,10 @@
|
||||
//
|
||||
// A function call node.
|
||||
//
|
||||
tree.Call = function (name, args) {
|
||||
tree.Call = function (name, args, index) {
|
||||
this.name = name;
|
||||
this.args = args;
|
||||
this.index = index;
|
||||
};
|
||||
tree.Call.prototype = {
|
||||
//
|
||||
@@ -24,7 +25,12 @@ tree.Call.prototype = {
|
||||
var args = this.args.map(function (a) { return a.eval(env) });
|
||||
|
||||
if (this.name in tree.functions) { // 1.
|
||||
return tree.functions[this.name].apply(tree.functions, args);
|
||||
try {
|
||||
return tree.functions[this.name].apply(tree.functions, args);
|
||||
} catch (e) {
|
||||
throw { message: "error evaluating function `" + this.name + "`",
|
||||
index: this.index };
|
||||
}
|
||||
} else { // 2.
|
||||
return new(tree.Anonymous)(this.name +
|
||||
"(" + args.map(function (a) { return a.toCSS() }).join(', ') + ")");
|
||||
|
||||
Reference in New Issue
Block a user