Commit 8bb1e6d0 authored by clemensh's avatar clemensh Committed by Commit bot

Add option to print all exceptions

When DevTools calls to JavaScript, it often ignores exceptions and just
fails since no value was returned.
The new --print-all-exceptions flag makes it easy to spot the location
and the reason for the thrown exception.

R=titzer@chromium.org

Review-Url: https://codereview.chromium.org/2417743004
Cr-Commit-Position: refs/heads/master@{#40340}
parent a40be67b
......@@ -877,6 +877,8 @@ DEFINE_INT(hash_seed, 0,
"Fixed seed to use to hash property keys (0 means random)"
"(with snapshots this option cannot override the baked-in seed)")
DEFINE_BOOL(trace_rail, false, "trace RAIL mode")
DEFINE_BOOL(print_all_exceptions, false,
"print exception object and stack trace on each thrown exception")
// runtime.cc
DEFINE_BOOL(runtime_call_stats, false, "report runtime call counts and times")
......
......@@ -1070,6 +1070,15 @@ Object* Isolate::Throw(Object* exception, MessageLocation* location) {
HandleScope scope(this);
Handle<Object> exception_handle(exception, this);
if (FLAG_print_all_exceptions) {
printf("=========================================================\n");
printf("Exception thrown:\n");
exception->Print();
printf("Stack Trace:\n");
PrintStack(stdout);
printf("=========================================================\n");
}
// Determine whether a message needs to be created for the given exception
// depending on the following criteria:
// 1) External v8::TryCatch missing: Always create a message because any
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment