On Sun, Apr 14, 2013 at 5:30 PM, <bodo.kai...@enabre.com> wrote: > Hello, > > I want to use a function which acts as internal exception shortcut > unfortunately I cannot pass the current scope so I would create a new one. > Is this whole strategy valid? If not how would it look right? >
My understanding, based on previous discussions on this list, is that a HandleScope is not needed at all if the code in question is being called from JS space (because such a call has an implicit HandleScope around it). Based on my own experience, your InvocationCallback and exception-thrower look perfectly koster to me, but i would drop both of the HandleScopes - IMO they are not needed because your InvocationCallback will be called from JS-space in response to a Function call, and such calls have an implicit Scope provided by the engine. > Handle<Value> SomeMethod(const Arguments &args) { > > HandleScope scope: > > if (!args[0]->IsObject() || args[0]->IsArray()) > > if i'm not mistaken (and i might be), IsObject() will(???) also return true for an Array because an Array is-a Object. > return ThrowTypeError("Argument must be a object literal."); > return scope.Close(args[0]->ToObject()); > }; > > NODE_MODULE(test, init); > > -- ----- stephan beal http://wanderinghorse.net/home/stephan/ http://gplus.to/sgbeal -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.