summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/exception.js
diff options
context:
space:
mode:
authorRyan Lewis <ryanharrisonlewis@gmail.com>2015-12-13 20:42:13 -0800
committerRyan Lewis <ryanharrisonlewis@gmail.com>2015-12-13 20:42:13 -0800
commit21bf95c92a1c04fd8a31742c1ea21ccb2d195c9c (patch)
treea120f52441e2f62ecb61696a4f67fdc1c15273b4 /lib/handlebars/exception.js
parentcc0b239aafefdef0342334b90f3c9b3ac6b19cea (diff)
parenta6121cae797161f74bdd5a25e0c56379992557d7 (diff)
downloadhandlebars.js-21bf95c92a1c04fd8a31742c1ea21ccb2d195c9c.zip
handlebars.js-21bf95c92a1c04fd8a31742c1ea21ccb2d195c9c.tar.gz
handlebars.js-21bf95c92a1c04fd8a31742c1ea21ccb2d195c9c.tar.bz2
Merge branch 'master' of https://github.com/ryanmurakami/handlebars.js
Diffstat (limited to 'lib/handlebars/exception.js')
-rw-r--r--lib/handlebars/exception.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/handlebars/exception.js b/lib/handlebars/exception.js
index 52499c0..af675d9 100644
--- a/lib/handlebars/exception.js
+++ b/lib/handlebars/exception.js
@@ -12,7 +12,7 @@ function Exception(message, node) {
message += ' - ' + line + ':' + column;
}
- let tmp = Error.prototype.constructor.call(this, message);
+ let tmp = Error.prototype.constructor.call(this, message, loc && loc.source, line);
// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
for (let idx = 0; idx < errorProps.length; idx++) {
@@ -24,9 +24,20 @@ function Exception(message, node) {
Error.captureStackTrace(this, Exception);
}
- if (loc) {
- this.lineNumber = line;
- this.column = column;
+ try {
+ if (loc) {
+ this.lineNumber = line;
+
+ // Work around issue under safari where we can't directly set the column value
+ /* istanbul ignore next */
+ if (Object.defineProperty) {
+ Object.defineProperty(this, 'column', {value: column});
+ } else {
+ this.column = column;
+ }
+ }
+ } catch (nop) {
+ /* Ignore if the browser is very particular */
}
}