Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: src/api.cc

Issue 171042: Added API call to get the stack trace for an exception (Closed)
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_);
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698