mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
If the callback throws an error and imports are syncronous, let the error fall through to the calling scope.
This commit is contained in:
@@ -10,13 +10,19 @@
|
||||
tree.importVisitor.prototype = {
|
||||
isReplacing: true,
|
||||
run: function (root) {
|
||||
// process the contents
|
||||
this._visitor.visit(root);
|
||||
var error;
|
||||
try {
|
||||
// process the contents
|
||||
this._visitor.visit(root);
|
||||
}
|
||||
catch(e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
this.isFinished = true;
|
||||
|
||||
if (this.importCount === 0) {
|
||||
this._finish();
|
||||
this._finish(error);
|
||||
}
|
||||
},
|
||||
visitImport: function (importNode, visitArgs) {
|
||||
@@ -43,11 +49,11 @@
|
||||
if (e && !e.filename) { e.index = importNode.index; e.filename = importNode.currentFileInfo.filename; }
|
||||
if (imported && !importNode.options.multiple) { importNode.skip = imported; }
|
||||
|
||||
var subFinish = function() {
|
||||
var subFinish = function(e) {
|
||||
importVisitor.importCount--;
|
||||
|
||||
if (importVisitor.importCount === 0 && importVisitor.isFinished) {
|
||||
importVisitor._finish();
|
||||
importVisitor._finish(e);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -477,13 +477,8 @@ less.Parser = function Parser(env) {
|
||||
};
|
||||
|
||||
if (env.processImports !== false) {
|
||||
try {
|
||||
new tree.importVisitor(this.imports, finish)
|
||||
.run(root);
|
||||
}
|
||||
catch(e) {
|
||||
error = e;
|
||||
}
|
||||
new tree.importVisitor(this.imports, finish)
|
||||
.run(root);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user