On Apr 7, 2009 4:15pm, ondras <[email protected]> wrote:
> I have a strange problem with the following code snippet:
...
> void test() {

> v8::HandleScope hs;

> v8::ThrowException(v8::String::New("!"));

There might (er, will) be those here who disagree with me on this point,  
but my recommendation is to get rid of the HandleScope. In 9 out of 10  
cases they cause segfaults for me.

> int main(int argc, char ** argv) {

> v8::HandleScope hs;

This is about the only place in my code where a HandleScope doesn't cause a  
segfault.

> v8::TryCatch tc;

> test();
> if (tc.HasCaught()) {

HasCaught() is new to me. The v8 docs say we should do:

Handle<Value> x = myfunc();
if( x.IsEmpty() ) {
... this theoretically means an exception was thrown, though an empty  
handle can be created w/o throwing...
}

i don't have access to the API docs at the moment, but if i'm not mistaken,  
that is the documented approach.

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to