diff options
Diffstat (limited to 'lib/handlebars/utils.js')
-rw-r--r-- | lib/handlebars/utils.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/handlebars/utils.js b/lib/handlebars/utils.js index b53c9ef..3bc7e9b 100644 --- a/lib/handlebars/utils.js +++ b/lib/handlebars/utils.js @@ -1,14 +1,16 @@ var Handlebars = require("./base"); // BEGIN(BROWSER) + +var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + Handlebars.Exception = function(message) { var tmp = Error.prototype.constructor.apply(this, arguments); - for (var p in tmp) { - if (tmp.hasOwnProperty(p)) { this[p] = tmp[p]; } + // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. + for (var idx = 0; idx < errorProps.length; idx++) { + this[errorProps[idx]] = tmp[errorProps[idx]]; } - - this.message = tmp.message; }; Handlebars.Exception.prototype = new Error(); |