Hi, gurus, Another exception-handling question for you...
My use-case is described here: http://code.google.com/p/v8-juice/wiki/V8Convert_Whio#EPFS.foreachInode() Please see the first 2 (small) code blocks and the short paragraph after that. The FIXME note there hints at my problem, which is described in my detail here... i have a C-level handle which has a for-each operation which calls a client-supplied callback for each entry in the handle. To expose that to JS i of course add the proverbial layer of indirection to map a JS function to the native callback function. The indirection/shim looks like this (only the last few lines are relevant to my question): static int ForeachInode_callback( whio_epfs * fs, whio_epfs_inode const * ent, void * clientData ) { ForeachInode * fi = (ForeachInode *)clientData; v8::Handle<v8::Object> idata = InodeToObject(ent); if( whio_epfs_has_namer(fs) ) { idata->Set(v8::String::NewSymbol("name"), CastToJS( fi->fs->name( ent->id ) ) ); } v8::Handle<v8::Value> av[] = { idata, fi->data }; v8::Handle<v8::Value> const & rc( fi->func->Call( fi->self, 2, av ) ); // How to tell if v8 threw here? return CastFromJS<int>(rc); } That last comment line sums up my question: how can i figure out if the call to fi->func->Call() throws? My goal is simply: if the JS callback throws then my native callback must return non-0 so that the C API knows an error has happened and it needs to stop looping. In addition, i want the JS exception to smack the client when the native for-each aborts and we return to script-space. As i recall (perhaps incorrectly), TryCatch::HasCaught() was always returning false the last time i tried to do this, and i don't recall ever finding a solution to the problem. :-? -- ----- stephan beal http://wanderinghorse.net/home/stephan/ -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
