Commit c3531512 by aquilescanta Committed by Oliver Woodman

Add errorCode to the EventLogger

PiperOrigin-RevId: 376126959
parent 0fb5fa75
...@@ -243,6 +243,14 @@ public class PlaybackException extends Exception implements Bundleable { ...@@ -243,6 +243,14 @@ public class PlaybackException extends Exception implements Bundleable {
} }
} }
/**
* Equivalent to {@link PlaybackException#getErrorCodeName(int)
* PlaybackException.getErrorCodeName(this.errorCode)}.
*/
public final String getErrorCodeName() {
return getErrorCodeName(errorCode);
}
/** An error code which identifies the cause of the playback failure. */ /** An error code which identifies the cause of the playback failure. */
@ErrorCode public final int errorCode; @ErrorCode public final int errorCode;
......
...@@ -24,6 +24,7 @@ import com.google.android.exoplayer2.C; ...@@ -24,6 +24,7 @@ import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaItem; import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Player.PlaybackSuppressionReason; import com.google.android.exoplayer2.Player.PlaybackSuppressionReason;
...@@ -598,6 +599,9 @@ public class EventLogger implements AnalyticsListener { ...@@ -598,6 +599,9 @@ public class EventLogger implements AnalyticsListener {
@Nullable String eventDescription, @Nullable String eventDescription,
@Nullable Throwable throwable) { @Nullable Throwable throwable) {
String eventString = eventName + " [" + getEventTimeString(eventTime); String eventString = eventName + " [" + getEventTimeString(eventTime);
if (throwable instanceof PlaybackException) {
eventString += ", errorCode=" + ((PlaybackException) throwable).getErrorCodeName();
}
if (eventDescription != null) { if (eventDescription != null) {
eventString += ", " + eventDescription; eventString += ", " + eventDescription;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment