mirror of https://gitee.com/bigwinds/arangodb
added better error reporting
This commit is contained in:
parent
1bdcc145b4
commit
a2fb92948e
|
@ -765,7 +765,13 @@ static v8::Handle<v8::Value> JS_Execute (v8::Arguments const& argv) {
|
|||
}
|
||||
|
||||
// execute script inside the context
|
||||
v8::Handle<v8::Script> script = v8::Script::Compile(source->ToString(), filename);
|
||||
v8::Handle<v8::Script> script;
|
||||
v8::Handle<v8::Value> result;
|
||||
|
||||
{
|
||||
v8::TryCatch tryCatch;
|
||||
|
||||
script = v8::Script::Compile(source->ToString(), filename);
|
||||
|
||||
// compilation failed, print errors that happened during compilation
|
||||
if (script.IsEmpty()) {
|
||||
|
@ -774,11 +780,12 @@ static v8::Handle<v8::Value> JS_Execute (v8::Arguments const& argv) {
|
|||
context->Exit();
|
||||
}
|
||||
|
||||
return scope.Close(v8::Undefined());
|
||||
TRI_LogV8Exception(&tryCatch);
|
||||
return scope.Close(v8::ThrowException(tryCatch.Exception()));
|
||||
}
|
||||
|
||||
// compilation succeeded, run the script
|
||||
v8::Handle<v8::Value> result = script->Run();
|
||||
result = script->Run();
|
||||
|
||||
if (result.IsEmpty()) {
|
||||
if (useSandbox) {
|
||||
|
@ -786,7 +793,9 @@ static v8::Handle<v8::Value> JS_Execute (v8::Arguments const& argv) {
|
|||
context->Exit();
|
||||
}
|
||||
|
||||
return scope.Close(v8::Undefined());
|
||||
TRI_LogV8Exception(&tryCatch);
|
||||
return scope.Close(v8::ThrowException(tryCatch.Exception()));
|
||||
}
|
||||
}
|
||||
|
||||
// copy result back into the sandbox
|
||||
|
|
Loading…
Reference in New Issue