Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 2f7de08550b54909cebe53ccf6585ba5c7113e45..5bc8ea453fbe5af90fb2f1af0a8bd959ebf05549 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -1219,6 +1219,23 @@ v8::Local<Value> v8::TryCatch::Exception() const { |
} |
+v8::Local<Value> v8::TryCatch::StackTrace() const { |
+ if (HasCaught()) { |
+ i::Object* raw_ptr = reinterpret_cast<i::Object*>(exception_); |
+ if (!raw_ptr->IsJSObject()) return v8::Local<Value>(); |
+ v8::HandleScope scope; |
+ i::Handle<i::Object> raw_obj(raw_ptr); |
Søren Thygesen Gjesse
2009/08/17 13:30:16
Why not just
i::Handle<i::JSObject> obj(i::JSObje
Christian Plesner Hansen
2009/08/17 13:33:59
Done
|
+ i::Handle<i::JSObject> obj = i::Handle<i::JSObject>::cast(raw_obj); |
+ i::Handle<i::String> name = i::Factory::LookupAsciiSymbol("stack"); |
+ if (!obj->HasProperty(*name)) |
+ return v8::Local<Value>(); |
+ return scope.Close(v8::Utils::ToLocal(i::GetProperty(obj, name))); |
+ } else { |
+ return v8::Local<Value>(); |
+ } |
+} |
+ |
+ |
v8::Local<v8::Message> v8::TryCatch::Message() const { |
if (HasCaught() && message_ != i::Smi::FromInt(0)) { |
i::Object* message = reinterpret_cast<i::Object*>(message_); |