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?

#include <v8.h>
#include <node.h>
 
inline Local<Value> ThrowTypeError(const char* message) {
    HandleScope scope;
        ThrowException(Exception::TypeError(String::New(message)));
 
    return scope.Close(Undefined());
};
 
Handle<Value> SomeMethod(const Arguments &args) {
    HandleScope scope:
 
    if (!args[0]->IsObject() || args[0]->IsArray())
        return ThrowTypeError("Argument must be a object literal.");
     return scope.Close(args[0]->ToObject());
};
 
NODE_MODULE(test, init);


https://gist.github.com/bodokaiser/5383105

Bodo

-- 
-- 
v8-users mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to