Skip to content

able to catch ruby proc exceptions with try/catch in JS, but they have no information #44

Closed
@seanmakesgames

Description

@seanmakesgames

Would love to prevent the 'catch' and forward them out to ruby if possible.

  def test_catch_rb
    context = MiniRacer::Context.new(timeout: 50)
    context.attach('crash', proc{ raise ArgumentError.new('???') })

    code = "function a() { \
              try { \
                crash(); \
              } catch(e) { return e; } \
            }\
            a();"

    assert_raises(ArgumentError) do
      context.eval(code)
    end
  end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions