Improve error message in RunRootClinits
Useful for diagnosing current instrumentation and golem issues.
Bug: 157459881
Test: Observe the new message
Change-Id: I5fa68aba5b4e2319504ed3b3ec70d48f1a87eec5
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index fa698f1..bbf59bc 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1133,8 +1133,10 @@
if (!c->IsArrayClass() && !c->IsPrimitive()) {
StackHandleScope<1> hs(self);
Handle<mirror::Class> h_class(hs.NewHandle(c));
- EnsureInitialized(self, h_class, true, true);
- self->AssertNoPendingException();
+ if (!EnsureInitialized(self, h_class, true, true)) {
+ LOG(FATAL) << "Exception when initializing " << h_class->PrettyClass()
+ << ": " << self->GetException()->Dump();
+ }
} else {
DCHECK(c->IsInitialized());
}