-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pass exception text into javascript #264
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -872,6 +872,14 @@ def test_pipe_leak | |
end | ||
end | ||
|
||
def test_capture_ruby_exception_message | ||
context = MiniRacer::Context.new() | ||
error_message = "Actual Error Message" | ||
context.attach("a", proc{|a| raise error_message}) | ||
|
||
assert_equal error_message, context.eval("try { a(); } catch (e) { e }") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't it rather weird that the return value of this is a Ruby exception converted to a JS |
||
end | ||
|
||
def test_symbol_support | ||
context = MiniRacer::Context.new() | ||
assert_equal :foo, context.eval("Symbol('foo')") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code previously throwed a JS String
"Ruby exception"
, and now throws a JS String with theexception.message
.I think it should throw an actual JS exception (an
Error
or subclass IIUC https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)