Index: Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp |
diff --git a/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp |
index 24dd7ba466baecd4f333a263c779a8bda801851d..993a23ef7924f94a2861b15f5f7132618ad05253 100644 |
--- a/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp |
+++ b/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp |
@@ -330,11 +330,24 @@ void V8InjectedScriptHost::evaluateMethodCustom(const v8::FunctionCallbackInfo<v |
ASSERT(isolate->InContext()); |
v8::TryCatch tryCatch; |
v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScript(expression, info.GetIsolate()); |
+ |
+ v8::Local<v8::Object> wrappedResult = v8::Object::New(isolate); |
if (tryCatch.HasCaught()) { |
- v8SetReturnValue(info, tryCatch.ReThrow()); |
- return; |
+ wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), tryCatch.Exception()); |
+ |
+ v8::Local<v8::Object> exceptionDetails = v8::Object::New(isolate); |
+ v8::Local<v8::Message> message = tryCatch.Message(); |
+ exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "text"), message->Get()); |
+ exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "url"), message->GetScriptOrigin().ResourceName()); |
+ exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "line"), v8::Integer::New(isolate, message->GetLineNumber())); |
+ exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "column"), v8::Integer::New(isolate, message->GetStartColumn())); |
+ exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), message->GetStackTrace()->AsArray()); |
+ wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"), exceptionDetails); |
+ } else { |
+ wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), result); |
+ wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"), v8::Undefined(isolate)); |
} |
- v8SetReturnValue(info, result); |
+ v8SetReturnValue(info, wrappedResult); |
} |
void V8InjectedScriptHost::setFunctionVariableValueMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |