Hi,

I have a strange problem with the following code snippet:


void test() {
  v8::HandleScope hs;
  v8::ThrowException(v8::String::New("!"));
}

int main(int argc, char ** argv) {
  v8::HandleScope hs;
  v8::Handle<v8::ObjectTemplate> globaltemplate =
v8::ObjectTemplate::New();
  v8::Handle<v8::Context> context = v8::Context::New(NULL,
globaltemplate);
  v8::Context::Scope context_scope(context);

  v8::TryCatch tc;
  test();

  if (tc.HasCaught()) {
    printf("caught :)");
  } else {
    printf("not caught :/");
  }
}



It looks liky my TryCatch never catches anything ("not caught" is
printed), although I explicitely throw an exception. What am I doing
wrong?

Also, the V8 API states that no JS operations can be done until an
exception gets "handled". What exactly does this mean? Is "tc.Reset()"
sufficent handling, or should I perform some more steps to handle it?


Sincerely,
Ondrej Zara



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

Reply via email to