mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
move trycatch out of protected method
This commit is contained in:
parent
f1e3db3aa6
commit
44af6d65f7
2 changed files with 7 additions and 4 deletions
|
@ -74,11 +74,14 @@ namespace rr {
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE TryCatch::setupAndCall(int* state, VALUE code) {
|
VALUE TryCatch::setupAndCall(int* state, VALUE code) {
|
||||||
return rb_protect(&doCall, code, state);
|
v8::TryCatch trycatch;
|
||||||
|
rb_iv_set(code, "_v8_trycatch", TryCatch(&trycatch));
|
||||||
|
VALUE result = rb_protect(&doCall, code, state);
|
||||||
|
rb_iv_set(code, "_v8_trycatch", Qnil);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE TryCatch::doCall(VALUE code) {
|
VALUE TryCatch::doCall(VALUE code) {
|
||||||
v8::TryCatch trycatch;
|
return rb_funcall(code, rb_intern("call"), 1, rb_iv_get(code, "_v8_trycatch"));
|
||||||
return rb_funcall(code, rb_intern("call"), 1, (VALUE)TryCatch(&trycatch));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@ describe V8::Error do
|
||||||
raise error
|
raise error
|
||||||
end
|
end
|
||||||
lambda {
|
lambda {
|
||||||
cxt.eval('three()')
|
cxt.eval('one()')
|
||||||
}.should raise_error {|e| e.should be error}
|
}.should raise_error {|e| e.should be error}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue