diff options
Diffstat (limited to 'lib/handlebars/exception.js')
-rw-r--r-- | lib/handlebars/exception.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/handlebars/exception.js b/lib/handlebars/exception.js index 8c5c2f6..3fde1c1 100644 --- a/lib/handlebars/exception.js +++ b/lib/handlebars/exception.js @@ -2,11 +2,14 @@ var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; function Exception(message, node) { - var line; - if (node && node.firstLine) { - line = node.firstLine; - - message += ' - ' + line + ':' + node.firstColumn; + var loc = node && node.loc, + line, + column; + if (loc) { + line = loc.start.line; + column = loc.start.column; + + message += ' - ' + line + ':' + column; } var tmp = Error.prototype.constructor.call(this, message); @@ -16,9 +19,9 @@ function Exception(message, node) { this[errorProps[idx]] = tmp[errorProps[idx]]; } - if (line) { + if (loc) { this.lineNumber = line; - this.column = node.firstColumn; + this.column = column; } } |