Skip to content

Commit

Permalink
deps: handlebars@4.3.3
Browse files Browse the repository at this point in the history
fixes #176
closes #175
closes #178
closes #179
  • Loading branch information
dougwilson committed Sep 27, 2019
1 parent 2f12c5e commit aed9d51
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
4 changes: 3 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ unreleased
* Fix async helpers not working when cache enabled
* Fix handling of exceptions from layout
* Fix handling of exceptions when cache enabled
* deps: handlebars@4.1.2
* deps: handlebars@4.3.3
- Block calling `helperMissing` and `blockHelperMissing` from templates
- Fix work-around for `constructor` blocking
* deps: walk@2.3.14

4.0.4 / 2019-04-14
Expand Down
25 changes: 19 additions & 6 deletions lib/hbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ function middleware(filename, options, cb) {
cb(null, res)
})
} catch (err) {
err.message = filename + ': ' + err.message
cb(err)
cb(prependFilenameToError(filename, err))
}

return
Expand All @@ -83,8 +82,7 @@ function middleware(filename, options, cb) {
cb(null, res);
});
} catch (err) {
err.message = filename + ': ' + err.message;
cb(err);
cb(prependFilenameToError(filename, err))
}
});
}
Expand All @@ -108,8 +106,7 @@ function middleware(filename, options, cb) {
cb(null, res)
})
} catch (err) {
err.message = filename + ': ' + err.message
cb(err)
cb(prependFilenameToError(filename, err))
}
});
}
Expand Down Expand Up @@ -151,6 +148,22 @@ function middleware(filename, options, cb) {

// TODO check if layout path has .hbs extension

function prependFilenameToError (filename, err) {
// prepend to the message
err.message = filename + ': ' + err.message

// restore error message on stack (https://github.com/wycats/handlebars.js/issues/1562)
if (typeof err.stack === 'string' && err.stack.indexOf(err.name + '\n') === 0 && err.stack.indexOf(err.message) === -1) {
Object.defineProperty(err, 'stack', {
configurable: true,
value: err.name + ': ' + err.message,
writable: true
})
}

return err
}

function cacheAndCompile(filename, str) {
var layout_template = handlebars.compile(str);
if (options.cache) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"repository": "pillarjs/hbs",
"main": "lib/hbs.js",
"dependencies": {
"handlebars": "4.1.2",
"handlebars": "4.3.3",
"walk": "2.3.14"
},
"devDependencies": {
Expand Down

0 comments on commit aed9d51

Please sign in to comment.