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

Unified Diff: chrome/renderer/module_system.cc

Issue 10874052: Make ModuleSystem::DumpException() handle empty handles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/module_system.cc
diff --git a/chrome/renderer/module_system.cc b/chrome/renderer/module_system.cc
index bec8925f524ab9715552c6f2bd69f925d7385088..a29eb3e7edf598faef65204e97b3a3f747ea9096 100644
--- a/chrome/renderer/module_system.cc
+++ b/chrome/renderer/module_system.cc
@@ -67,12 +67,23 @@ void ModuleSystem::DumpException(const v8::TryCatch& try_catch) {
return;
}
- LOG(ERROR) << "["
- << *v8::String::Utf8Value(
- message->GetScriptResourceName()->ToString())
- << "(" << message->GetLineNumber() << ")] "
- << *v8::String::Utf8Value(message->Get())
- << "{" << *v8::String::Utf8Value(try_catch.StackTrace()) << "}";
+ std::string resource_name = "<unknown resource>";
+ if (!message->GetScriptResourceName().IsEmpty()) {
+ resource_name = *v8::String::Utf8Value(
+ message->GetScriptResourceName()->ToString());
Lei Zhang 2012/08/24 18:31:48 nit: weird spacing. How about: resource_name =
+ }
+
+ std::string error_message = "<no error message>";
+ if (!message->Get().IsEmpty())
+ error_message = *v8::String::Utf8Value(message->Get());
+
+ std::string stack_trace = "<stack trace unavailable>";
+ if (!try_catch.StackTrace().IsEmpty())
+ stack_trace = *v8::String::Utf8Value(try_catch.StackTrace());
+
+ LOG(ERROR) << "[" << resource_name << "(" << message->GetLineNumber() << ")] "
+ << error_message
+ << "{" << stack_trace << "}";
}
void ModuleSystem::Require(const std::string& module_name) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698