Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove severity from monitoring error #757

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading