Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line and filename of exception #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 15 additions & 2 deletions lib/less/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,26 @@ class ParseError < StandardError
# Copies over `error`'s message and backtrace
# @param [V8::JSError] error native error
def initialize(error)
super(error.message)
@backtrace = error.backtrace
@line = error.value.line if error.value.respond_to? :line
@filename = error.value.filename if error.value.respond_to? :filename
@message = error.message

super(self.full_message)

@backtrace = error.backtrace
end

# @return [Array] the backtrace frames
def backtrace
@backtrace
end

def full_message
if @line && @filename
"Error at #{@filename}:#{@line} - #{@message}"
else
@message
end
end
end
end