Sha256: 5b23102880a74ceeab94a45bb21559b5e9bf0d82dc86ff51af1faf3d0424ffa1

Contents?: true

Size: 649 Bytes

Versions: 34

Compression:

Stored size: 649 Bytes

Contents

require 'spec_helper'

describe V8::C::Exception do
  it "can be thrown from Ruby" do
    t = V8::C::FunctionTemplate::New(method(:explode))
    @cxt.Global().Set("explode", t.GetFunction())
    script = V8::C::Script::New(<<-JS, '<eval>')
    (function() {
      try {
        explode()
      } catch (e) {
        return e.message
      }
    })()
    JS
    result = script.Run()
    result.should_not be_nil
    result.should be_kind_of(V8::C::String)
    result.Utf8Value().should eql 'did not pay syntax'
  end

  def explode(arguments)
    error = V8::C::Exception::SyntaxError('did not pay syntax')
    V8::C::ThrowException(error)
  end
end

Version data entries

34 entries across 34 versions & 7 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/therubyracer-0.12.2/spec/c/exception_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.11.4/spec/c/exception_spec.rb
therubyracer-tmpfork-0.12.2 spec/c/exception_spec.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/therubyracer-0.12.2/spec/c/exception_spec.rb
therubyracer-0.12.2 spec/c/exception_spec.rb
therubyracer-0.12.1 spec/c/exception_spec.rb
therubyracer-discourse-0.12.0 spec/c/exception_spec.rb
therubyracer-0.12.0 spec/c/exception_spec.rb
therubyracer-0.11.4 spec/c/exception_spec.rb
therubyracer-0.11.3 spec/c/exception_spec.rb
therubyracer-0.11.2 spec/c/exception_spec.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/therubyracer-0.11.0/spec/c/exception_spec.rb
therubyracer-0.11.1 spec/c/exception_spec.rb
therubyracer-0.11.1beta1 spec/c/exception_spec.rb
therubyracer-0.11.0 spec/c/exception_spec.rb
therubyracer-0.11.0beta8-x86-freebsd-9 spec/c/exception_spec.rb
therubyracer-0.11.0beta8-x86_64-linux spec/c/exception_spec.rb
therubyracer-0.11.0beta8-x86-linux spec/c/exception_spec.rb
therubyracer-0.11.0beta8 spec/c/exception_spec.rb
therubyracer-0.11.0beta7-x86_64-linux spec/c/exception_spec.rb