diff options
Diffstat (limited to 'lib/handlebars/exception.js')
-rw-r--r-- | lib/handlebars/exception.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/handlebars/exception.js b/lib/handlebars/exception.js new file mode 100644 index 0000000..6de9cfd --- /dev/null +++ b/lib/handlebars/exception.js @@ -0,0 +1,15 @@ + +var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + +function Exception(/* message */) { + var tmp = Error.prototype.constructor.apply(this, arguments); + + // 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]]; + } +} + +Exception.prototype = new Error(); + +export default Exception; |