When we can't provide both a message and a cause, prefer the message.
Both options can drop meaningful information, but this one should at least be less confusing, especially in combination with stack-trace stripping.
Context: []
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169280333
diff --git a/core/src/main/java/com/google/common/truth/Truth.java b/core/src/main/java/com/google/common/truth/Truth.java
index ac98778..225d8f4 100644
--- a/core/src/main/java/com/google/common/truth/Truth.java
+++ b/core/src/main/java/com/google/common/truth/Truth.java
@@ -104,8 +104,8 @@
failure.initCause(cause);
} catch (IllegalStateException alreadyInitializedBecauseOfHarmonyBug) {
// https://code.google.com/p/android/issues/detail?id=29378
- // No message, but it's the best we can do without awful hacks.
- throw stripTruthStackFrames(new AssertionError(cause));
+ // Skip initCause. That's sad, but it's the best we can do without awful hacks.
+ // TODO(cpovirk): Actually, maybe we can override getCause(). Try that someday.
}
}
return stripTruthStackFrames(failure);