Sha256: d9648ac1c8c73a6583a1395fb98726c59a9ca51c9480050f0ffe182c51612230

Contents?: true

Size: 731 Bytes

Versions: 7

Compression:

Stored size: 731 Bytes

Contents

module V8
  class Portal
    class Caller
      
      def initialize(portal)
        @portal = portal
      end
      
      def raw
        begin
          yield
        rescue Exception => e
          case e
          when SystemExit, NoMemoryError
            raise e
          else
            error = V8::C::Exception::Error(V8::C::String::New(e.message))
            error.SetHiddenValue("TheRubyRacer::Cause", C::External::New(e))
            V8::C::ThrowException(error)
          end
        end
      end

      def protect(*args, &block)
        @portal.v8 raw(*args, &block)
      end

      def invoke(code, *args, &block)
        protect do
          code.call(*args, &block)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
therubyracer-0.9.0beta7 lib/v8/portal/caller.rb
therubyracer-0.9.0beta6 lib/v8/portal/caller.rb
therubyracer-0.9.0beta5 lib/v8/portal/caller.rb
therubyracer-0.9.0beta4 lib/v8/portal/caller.rb
therubyracer-0.9.0beta3 lib/v8/portal/caller.rb
therubyracer-0.9.0beta2 lib/v8/portal/caller.rb
therubyracer-0.9.0beta1 lib/v8/portal/caller.rb