mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
PlayerListener: do not swallow exceptions thrown before waiting
If an error occurred in the player before the test was calling one of the waitUntilSomething() methods, a timeout exception was thrown instead of the actual error. PiperOrigin-RevId: 713292292
This commit is contained in:
parent
b321c8d3bd
commit
d9776e74c8
1 changed files with 7 additions and 1 deletions
|
|
@ -130,9 +130,15 @@ public final class PlayerTestListener implements Player.Listener, AnalyticsListe
|
||||||
|
|
||||||
private void waitOrThrow(ConditionVariable conditionVariable)
|
private void waitOrThrow(ConditionVariable conditionVariable)
|
||||||
throws TimeoutException, PlaybackException {
|
throws TimeoutException, PlaybackException {
|
||||||
if (!conditionVariable.block(testTimeoutMs)) {
|
maybeThrowPlaybackException();
|
||||||
|
boolean conditionVariableTimedOut = !conditionVariable.block(testTimeoutMs);
|
||||||
|
maybeThrowPlaybackException();
|
||||||
|
if (conditionVariableTimedOut) {
|
||||||
throw new TimeoutException();
|
throw new TimeoutException();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void maybeThrowPlaybackException() throws PlaybackException {
|
||||||
@Nullable PlaybackException playbackException = this.playbackException.get();
|
@Nullable PlaybackException playbackException = this.playbackException.get();
|
||||||
if (playbackException != null) {
|
if (playbackException != null) {
|
||||||
throw playbackException;
|
throw playbackException;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue