Skip to content

Commit 5d68f50

Browse files
Catch Error when dumping thread states in IdlingPolicy.
Expand the catch block to include `Error` types in addition to `RuntimeException` when calling `TestOutputEmitter.dumpThreadStates`. This ensures that any issues during thread state dumping are suppressed and added to the `AppNotIdleException`, preserving the original exception as the primary cause. `java.lang.ExceptionInInitializerError` can happen when static initializing `TestOutputEmitter` if more than one service is discovered. PiperOrigin-RevId: 802644040
1 parent d257dfc commit 5d68f50

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

espresso/core/java/androidx/test/espresso/IdlingPolicy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void handleTimeout(List<String> busyResources, String message) {
6363
AppNotIdleException.create(busyResources, message);
6464
try {
6565
TestOutputEmitter.dumpThreadStates("ThreadState-AppNotIdleException.txt");
66-
} catch (RuntimeException e) {
66+
} catch (RuntimeException | Error e) {
6767
appNotIdleException.addSuppressed(e);
6868
}
6969
throw appNotIdleException;

0 commit comments

Comments
 (0)