Skip to content

Commit

Permalink
Remove severity from monitoring error (#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 authored Oct 21, 2024
1 parent 9eb1290 commit 66b30d2
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ internal class Monitoring(
data = ErrorMessageData(
throwable = error.cause ?: error,
player = player,
severity = ErrorMessageData.Severity.FATAL,
url = playbackMetrics?.url.toString(),
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package ch.srgssr.pillarbox.player.monitoring.models

import androidx.media3.common.Player
import ch.srgssr.pillarbox.player.extension.getPositionTimestamp
import ch.srgssr.pillarbox.player.monitoring.models.ErrorMessageData.Severity
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand All @@ -19,7 +18,6 @@ import kotlinx.serialization.Serializable
* @property name The name of the error.
* @property position The position of the player when the error occurred, in milliseconds, or `null` if not available.
* @property positionTimestamp The current player timestamp, as retrieved from the playlist.
* @property severity The severity of the error, either [FATAL][Severity.FATAL] or [WARNING][Severity.WARNING].
* @property url The last loaded url.
*/
@Serializable
Expand All @@ -30,24 +28,10 @@ data class ErrorMessageData(
val name: String,
val position: Long?,
@SerialName("position_timestamp") val positionTimestamp: Long?,
val severity: Severity,
val url: String,
) : MessageData {
/**
* Represents a [Player][androidx.media3.common.Player] error severity.
*/
@Suppress("UndocumentedPublicProperty")
enum class Severity {
@SerialName("Fatal")
FATAL,

@SerialName("Warning")
WARNING,
}

constructor(
throwable: Throwable,
severity: Severity,
player: Player,
url: String,
) : this(
Expand All @@ -57,7 +41,6 @@ data class ErrorMessageData(
name = throwable::class.simpleName.orEmpty(),
position = player.currentPosition,
positionTimestamp = player.getPositionTimestamp(),
severity = severity,
url = url,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class ErrorMessageDataTest {
val throwable = IllegalStateException()
val qosErrorMessageData = ErrorMessageData(
throwable = throwable,
severity = ErrorMessageData.Severity.WARNING,
player = player,
url = URL,
)
Expand All @@ -55,7 +54,6 @@ class ErrorMessageDataTest {
assertEquals("IllegalStateException", qosErrorMessageData.name)
assertEquals(CURRENT_POSITION, qosErrorMessageData.position)
assertNull(qosErrorMessageData.positionTimestamp)
assertEquals(ErrorMessageData.Severity.WARNING, qosErrorMessageData.severity)
assertEquals(URL, qosErrorMessageData.url)
}

Expand All @@ -65,7 +63,6 @@ class ErrorMessageDataTest {
val throwable = RuntimeException("Something bad happened", cause)
val qosErrorMessageData = ErrorMessageData(
throwable = throwable,
severity = ErrorMessageData.Severity.FATAL,
player = player,
url = URL,
)
Expand All @@ -83,7 +80,6 @@ class ErrorMessageDataTest {
assertEquals("RuntimeException", qosErrorMessageData.name)
assertEquals(CURRENT_POSITION, qosErrorMessageData.position)
assertNull(qosErrorMessageData.positionTimestamp)
assertEquals(ErrorMessageData.Severity.FATAL, qosErrorMessageData.severity)
assertEquals(URL, qosErrorMessageData.url)
}

Expand Down

0 comments on commit 66b30d2

Please sign in to comment.