I tried doing the same thing as you in your code
HandleScope handle_scope;
Handle<Value> exception;
do {
TryCatch try_catch;
// FIXME: The following two may degrade performance. Benchmarks
needed !
try_catch.SetCaptureMessage(true);
try_catch.SetVerbose(true);
String::Utf8Value utf8_value(source);
Handle<Script> script = Script::Compile(source, fromFileName);
if (script.IsEmpty()) {
// Print errors that happened during compilation.
exception = try_catch.Exception();
//k7::trace(&try_catch);
//return false;
}
Handle<Value> result = script->Run();
if (result.IsEmpty()) {
// Print errors that happened during execution.
exception = try_catch.Exception();
//k7::trace(&try_catch);
//return false;
}
} while (false);
if ( !exception.IsEmpty() ) {
ThrowException(exception);
return false;
}
return true;
but the result is exactly the same as with the previous version... is there
something I'm not doing properly ?
-- Sébastien
On Tue, Jun 2, 2009 at 11:25 AM, Stephan Beal <[email protected]> wrote:
>
> 2009/6/2 Sébastien Pierre <[email protected]>:
> > at #<an Object>.command
> >
> > ( #<an Object>.command being the JS snippet that reads the file and evals
> > it)
>
> i had similar problems when evaling an include()d file and had to do
> some hopping around with the exception catching to make it work how i
> wanted. See:
>
>
> http://code.google.com/p/v8-juice/source/browse/trunk/src/lib/juice/juice.cc
>
> in the IncludeScript() function. Inside the do{...}while(false) loop
> you'll see some weird stuff with copying an exception object. That
> approach allowed me to get the exception back into my main script,
> with line numbers and whatnot intact. No idea if all this is really
> required, but "it worked for me."
>
> --
> ----- stephan beal
> http://wanderinghorse.net/home/stephan/
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---