Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index b33dd0a0645fc0f30e0a4ba8723da932ac6b3894..ff94105834004077bb8406dad939f42d83e8d6c7 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -909,14 +909,10 @@ |
} |
-void Isolate::ReportBootstrappingException(Handle<Object> exception, |
- MessageLocation* location) { |
+void ReportBootstrappingException(Handle<Object> exception, |
+ MessageLocation* location) { |
base::OS::PrintError("Exception thrown during bootstrapping\n"); |
- if (location == NULL || location->script().is_null()) { |
- exception->Print(); |
- PrintStack(stdout); |
- return; |
- } |
+ if (location == NULL || location->script().is_null()) return; |
// We are bootstrapping and caught an error where the location is set |
// and we have a script for the location. |
// In this case we could have an extension (or an internal error |
@@ -985,12 +981,8 @@ |
debug()->OnThrow(exception_handle); |
} |
- if (bootstrapper()->IsActive()) { |
- // It's not safe to try to make message objects or collect stack traces |
- // while the bootstrapper is active since the infrastructure may not have |
- // been properly initialized. |
- ReportBootstrappingException(exception_handle, location); |
- } else if (requires_message && !rethrowing_message) { |
+ // Generate the message if required. |
+ if (requires_message && !rethrowing_message) { |
MessageLocation potential_computed_location; |
if (location == NULL) { |
// If no location was specified we use a computed one instead. |
@@ -998,20 +990,27 @@ |
location = &potential_computed_location; |
} |
- Handle<Object> message_obj = CreateMessage(exception_handle, location); |
- thread_local_top()->pending_message_obj_ = *message_obj; |
- |
- // If the abort-on-uncaught-exception flag is specified, abort on any |
- // exception not caught by JavaScript, even when an external handler is |
- // present. This flag is intended for use by JavaScript developers, so |
- // print a user-friendly stack trace (not an internal one). |
- if (FLAG_abort_on_uncaught_exception && |
- PredictExceptionCatcher() != CAUGHT_BY_JAVASCRIPT) { |
- FLAG_abort_on_uncaught_exception = false; // Prevent endless recursion. |
- PrintF(stderr, "%s\n\nFROM\n", |
- MessageHandler::GetLocalizedMessage(this, message_obj).get()); |
- PrintCurrentStackTrace(stderr); |
- base::OS::Abort(); |
+ if (bootstrapper()->IsActive()) { |
+ // It's not safe to try to make message objects or collect stack traces |
+ // while the bootstrapper is active since the infrastructure may not have |
+ // been properly initialized. |
+ ReportBootstrappingException(exception_handle, location); |
+ } else { |
+ Handle<Object> message_obj = CreateMessage(exception_handle, location); |
+ thread_local_top()->pending_message_obj_ = *message_obj; |
+ |
+ // If the abort-on-uncaught-exception flag is specified, abort on any |
+ // exception not caught by JavaScript, even when an external handler is |
+ // present. This flag is intended for use by JavaScript developers, so |
+ // print a user-friendly stack trace (not an internal one). |
+ if (FLAG_abort_on_uncaught_exception && |
+ PredictExceptionCatcher() != CAUGHT_BY_JAVASCRIPT) { |
+ FLAG_abort_on_uncaught_exception = false; // Prevent endless recursion. |
+ PrintF(stderr, "%s\n\nFROM\n", |
+ MessageHandler::GetLocalizedMessage(this, message_obj).get()); |
+ PrintCurrentStackTrace(stderr); |
+ base::OS::Abort(); |
+ } |
} |
} |