Distinguish exceptions caught at top level.
This commit is contained in:
parent
efb9ff1fe7
commit
0c5a1a6c35
@ -20,18 +20,32 @@ package com.google.android.exoplayer;
|
|||||||
* <p>
|
* <p>
|
||||||
* Where possible, the cause returned by {@link #getCause()} will indicate the reason for failure.
|
* Where possible, the cause returned by {@link #getCause()} will indicate the reason for failure.
|
||||||
*/
|
*/
|
||||||
public class ExoPlaybackException extends Exception {
|
public final class ExoPlaybackException extends Exception {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True if the cause (i.e. the {@link Throwable} returned by {@link #getCause()}) was only caught
|
||||||
|
* by a fail-safe at the top level of the player. False otherwise.
|
||||||
|
*/
|
||||||
|
public final boolean caughtAtTopLevel;
|
||||||
|
|
||||||
public ExoPlaybackException(String message) {
|
public ExoPlaybackException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
|
caughtAtTopLevel = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExoPlaybackException(Throwable cause) {
|
public ExoPlaybackException(Throwable cause) {
|
||||||
super(cause);
|
super(cause);
|
||||||
|
caughtAtTopLevel = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExoPlaybackException(String message, Throwable cause) {
|
public ExoPlaybackException(String message, Throwable cause) {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
|
caughtAtTopLevel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* package */ ExoPlaybackException(Throwable cause, boolean caughtAtTopLevel) {
|
||||||
|
super(cause);
|
||||||
|
this.caughtAtTopLevel = caughtAtTopLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ import java.util.List;
|
|||||||
return true;
|
return true;
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(TAG, "Internal runtime error.", e);
|
Log.e(TAG, "Internal runtime error.", e);
|
||||||
eventHandler.obtainMessage(MSG_ERROR, new ExoPlaybackException(e)).sendToTarget();
|
eventHandler.obtainMessage(MSG_ERROR, new ExoPlaybackException(e, true)).sendToTarget();
|
||||||
stopInternal();
|
stopInternal();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user