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

Unified Diff: src/isolate.cc

Issue 630373003: Add stack trace to the promise reject callback. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 7cf525d3e157a052dd78f21e25df1432518ee9c1..684f03e49cd9a37eb238d1920027d225054f890f 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2272,8 +2272,17 @@ void Isolate::ReportPromiseReject(Handle<JSObject> promise,
Handle<Object> value,
v8::PromiseRejectEvent event) {
if (promise_reject_callback_ == NULL) return;
- promise_reject_callback_(v8::Utils::PromiseToLocal(promise),
- v8::Utils::ToLocal(value), event);
+ Handle<JSArray> stack_trace;
+ if (event == v8::kPromiseRejectWithNoHandler &&
+ capture_stack_trace_for_uncaught_exceptions_ && value->IsJSObject()) {
aandrey 2014/10/07 10:49:05 I think we can drop the capture_stack_trace_for_un
+ Handle<JSObject> error_obj = Handle<JSObject>::cast(value);
+ Handle<Name> key = factory()->detailed_stack_trace_symbol();
+ Handle<Object> property = JSObject::GetDataProperty(error_obj, key);
+ if (property->IsJSArray()) stack_trace = Handle<JSArray>::cast(property);
+ }
+ promise_reject_callback_(v8::Utils::PromiseToLocal(promise), event,
+ v8::Utils::ToLocal(value),
+ v8::Utils::StackTraceToLocal(stack_trace));
}

Powered by Google App Engine
This is Rietveld 408576698