Skip to content

Commit

Permalink
Merge pull request #634 from oyyd/fix-asyncif-err
Browse files Browse the repository at this point in the history
fix #571, make asyncif handle error
  • Loading branch information
carljm committed Jan 14, 2016
1 parent a643784 commit b89a34e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ var Compiler = Object.extend({
compileIfAsync: function(node, frame) {
this.emit('(function(cb) {');
this.compileIf(node, frame, true);
this.emit('})(function() {');
this.emit('})(' + this.makeCallback());
this.addScopeLevel();
},

Expand Down
14 changes: 14 additions & 0 deletions tests/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,20 @@
finish(done);
});

it('should throw an error when including a file that calls an undefined macro even inside {% if %} tag', function(done) {
render(
'{% if true %}{% include "undefined-macro.html" %}{% endif %}',
{},
{ noThrow: true },
function(err, res) {
expect(res).to.be(undefined);
expect(err).to.match(/Unable to call `\w+`, which is undefined or falsey/);
}
);

finish(done);
});

it('should throw an error when including a file that imports macro that calls an undefined macro', function(done) {
render(
'{% include "import-macro-call-undefined-macro.html" %}',
Expand Down

0 comments on commit b89a34e

Please sign in to comment.