Throw exception if there's a contact loader error

Bug: 5193744
Change-Id: I3a9024f090efc581dec96c7a84580eed1864de42
diff --git a/src/com/android/contacts/detail/ContactLoaderFragment.java b/src/com/android/contacts/detail/ContactLoaderFragment.java
index 265550b..c82d735 100644
--- a/src/com/android/contacts/detail/ContactLoaderFragment.java
+++ b/src/com/android/contacts/detail/ContactLoaderFragment.java
@@ -187,11 +187,18 @@
                 return;
             }
 
-            if (data != ContactLoader.Result.NOT_FOUND && data != ContactLoader.Result.ERROR) {
-                mContactData = data;
-            } else {
+            if (data == ContactLoader.Result.ERROR) {
+                // This shouldn't ever happen, so throw an exception. The {@link ContactLoader}
+                // should log the actual exception.
+                // TODO: Make the {@link ContactLoader.Result} pass the exception so we can include
+                // the original stack trace when this error is thrown.
+                throw new IllegalStateException("The result of the ContactLoader is "
+                        + "ContactLoader.Result.ERROR");
+            } else if (data == ContactLoader.Result.NOT_FOUND) {
                 Log.i(TAG, "No contact found: " + ((ContactLoader)loader).getLookupUri());
                 mContactData = null;
+            } else {
+                mContactData = data;
             }
 
             if (mListener != null) {