From 6393ea9e1afea0da51cbbd23df48fff503e7b11d Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Tue, 23 Sep 2014 14:29:45 +0000 Subject: [PATCH] Preserve message when rethrowing exception A new message was always generated if there is a the top-most verbose TryCatch, even when rethrowing an exception from a TryCatch that is going out of scope, and we already have a message. BUG=v8:3583 LOG=Y R=yangguo@chromium.org Review URL: https://codereview.chromium.org/587703002 Patch from Jens Widell . git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24152 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/isolate.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/isolate.cc b/src/isolate.cc index e960445321..c6a8b813be 100644 --- a/src/isolate.cc +++ b/src/isolate.cc @@ -1019,9 +1019,9 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) { ShouldReportException(&can_be_caught_externally, catchable_by_javascript); bool report_exception = catchable_by_javascript && should_report_exception; bool try_catch_needs_message = - can_be_caught_externally && try_catch_handler()->capture_message_ && - !thread_local_top()->rethrowing_message_; + can_be_caught_externally && try_catch_handler()->capture_message_; bool bootstrapping = bootstrapper()->IsActive(); + bool rethrowing_message = thread_local_top()->rethrowing_message_; thread_local_top()->rethrowing_message_ = false; @@ -1031,7 +1031,7 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) { } // Generate the message if required. - if (report_exception || try_catch_needs_message) { + if (!rethrowing_message && (report_exception || try_catch_needs_message)) { MessageLocation potential_computed_location; if (location == NULL) { // If no location was specified we use a computed one instead.