Class: V8::JSError

Inherits:
Object
  • Object
show all
Defined in:
lib/handlebar_wax/v8.rb

Overview

Monkey patches due to bugs in RubyRacer

Instance Method Summary collapse

Constructor Details

#initialize(try, to) ⇒ JSError

Returns a new instance of JSError.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/handlebar_wax/v8.rb', line 5

def initialize(try, to)
  @to = to
  begin
    super(initialize_unsafe(try))
  rescue Exception => e
    # Original code does not make an Array here
    @boundaries = [Boundary.new(:rbframes => e.backtrace)]
    @value = e
    super("BUG! please report. JSError#initialize failed!: #{e.message}")
  end
end

Instance Method Details

#parse_js_frames(try) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/handlebar_wax/v8.rb', line 17

def parse_js_frames(try)
  raw = @to.rb(try.StackTrace())
  if raw && !raw.empty?
    raw.split("\n")[1..-1].tap do |frames|
      # Original code uses strip!, and the frames are not guaranteed to be strippable
      frames.each {|frame| frame.strip.chomp!(",")}
    end
  else
    []
  end
end