Skip to content

Instantly share code, notes, and snippets.

@danhedron
Created June 29, 2012 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danhedron/c91cc252aa458b8436ff to your computer and use it in GitHub Desktop.
Save danhedron/c91cc252aa458b8436ff to your computer and use it in GitHub Desktop.
Handle<Value> require( const Arguments& args ) {
HandleScope handle_scope;
String::Utf8Value file(args[i]);
TryCatch tryc;
Logging::getLog()->log("Executing: " + std::string(*file));
Handle<String> source = String::New(loadSource(*file).c_str());
Handle<Script> script = Script::New(source, args[i]);
if( tryc.HasCaught() ) {
String::AsciiValue stacktr(tryc.StackTrace());
Logging::getLog()->log(*stacktr);
}
Handle<Value> r = script->Run();
if( tryc.HasCaught() ) {
String::AsciiValue stacktr(tryc.StackTrace());
Logging::getLog()->log(*stacktr);
}
if( !r.IsEmpty() )
{
return handle_scope.Close(r);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment