My case is different, I don't run a script, I just call a function that returns a Value. This function may fail, and if it does, it returns an exception object, which I need to detect abort further processing and return the exception to V8.
On Mar 16, 8:23 am, javamonk <[email protected]> wrote: > You can use a v8::TryCatch for exception. > > v8::TryCatch try_catch; > // .... > v8::Handle<v8::Value> result = script->Run(); > if (result.IsEmpty()) { > v8::String::Utf8Value exception(try_catch->Exception()); > v8::Handle<v8::Message> message = try_catch->Message(); > // message contains exception info > > } > > You can throw exception by return this: > return > v8::ThrowException(v8::Exception::Error(v8::String::New("message > here.."))); > > On 3月16日, 上午2时40分, avasilev <[email protected]> wrote: > > > > > > > > > Hello, > > I need a way to determine if a Value is an exception. It doesn't > > matter what exception type is used, I will use an exception for which > > Value() has a way to determine if it is sunc an exception. So I found > > the IsNativeError(), but there is nothing about it - how to create > > such exceptions, what do they mean? Or is there a way to determine if > > a called function has returned its value via ThrowException(), so that > > I abort processing and return immediately the exception object? -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
