Skip to content

Commit

Permalink
Handle unexpected error messages better
Browse files Browse the repository at this point in the history
  • Loading branch information
lautis committed Sep 25, 2019
1 parent 9de67eb commit 116444d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/uglifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ def format_lines(lines, options)
end

def context_lines_message(source, line_number, column)
return if line_number.nil?

line_index = line_number - 1
lines = source.split("\n")

Expand All @@ -280,7 +282,7 @@ def context_lines_message(source, line_number, column)

def error_message(result, options)
err = result['error']
harmony_msg = harmony? ? '' : harmony_error_message(err['message'])
harmony_msg = harmony? ? '' : harmony_error_message(err['message'].to_s)
src_ctx = context_lines_message(options[:source], err['line'], err['col'])
"#{err['message']}#{harmony_msg}\n#{src_ctx}"
end
Expand Down

0 comments on commit 116444d

Please sign in to comment.