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 {
}
}
/**
* 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. */
@ErrorCode public final int errorCode;
......
......@@ -24,6 +24,7 @@ import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Player.PlaybackSuppressionReason;
......@@ -598,6 +599,9 @@ public class EventLogger implements AnalyticsListener {
@Nullable String eventDescription,
@Nullable Throwable throwable) {
String eventString = eventName + " [" + getEventTimeString(eventTime);
if (throwable instanceof PlaybackException) {
eventString += ", errorCode=" + ((PlaybackException) throwable).getErrorCodeName();
}
if (eventDescription != null) {
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