mirror of
https://github.com/rubyjs/therubyrhino
synced 2023-03-27 23:21:34 -04:00
make sure thrown values are correctly raised
e.g. from `function foo() { throw 'bar' }` specs for this coming with redjs v0.4.6
This commit is contained in:
parent
a38575a3d0
commit
6c962f7db0
1 changed files with 4 additions and 0 deletions
|
@ -159,6 +159,8 @@ class Java::OrgMozillaJavascript::BaseFunction
|
||||||
# TODO can't pass Undefined.instance as this - it's not a Scriptable !?
|
# TODO can't pass Undefined.instance as this - it's not a Scriptable !?
|
||||||
this = Rhino::JS::ScriptRuntime.getGlobal(context)
|
this = Rhino::JS::ScriptRuntime.getGlobal(context)
|
||||||
__call__(context, scope, this, Rhino.args_to_javascript(args, scope))
|
__call__(context, scope, this, Rhino.args_to_javascript(args, scope))
|
||||||
|
rescue Rhino::JS::JavaScriptException => e
|
||||||
|
raise Rhino::JSError.new(e)
|
||||||
ensure
|
ensure
|
||||||
Rhino::JS::Context.exit
|
Rhino::JS::Context.exit
|
||||||
end
|
end
|
||||||
|
@ -176,6 +178,8 @@ class Java::OrgMozillaJavascript::BaseFunction
|
||||||
def new(*args)
|
def new(*args)
|
||||||
context = Rhino::JS::Context.enter; scope = current_scope(context)
|
context = Rhino::JS::Context.enter; scope = current_scope(context)
|
||||||
construct(context, scope, Rhino.args_to_javascript(args, scope))
|
construct(context, scope, Rhino.args_to_javascript(args, scope))
|
||||||
|
rescue Rhino::JS::JavaScriptException => e
|
||||||
|
raise Rhino::JSError.new(e)
|
||||||
ensure
|
ensure
|
||||||
Rhino::JS::Context.exit
|
Rhino::JS::Context.exit
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue