ART: Improve error message on oat writer failure

Try to log the pending exception to help resolve issues.

Bug: 16406811
Change-Id: I035ae9e59a5ee02b9e90c35c0644ec088d3c7d12
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 7ac685b..0eaac6b 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1101,6 +1101,12 @@
       (*tlsPtr_.name == kThreadNameDuringStartup);
 }
 
+void Thread::AssertPendingException() const {
+  if (UNLIKELY(!IsExceptionPending())) {
+    LOG(FATAL) << "Pending exception expected.";
+  }
+}
+
 void Thread::AssertNoPendingException() const {
   if (UNLIKELY(IsExceptionPending())) {
     ScopedObjectAccess soa(Thread::Current());