catch serialization

This commit is contained in:
Milos Kozak 2022-07-10 20:48:19 +02:00
parent 9b6477381b
commit e1423c0f82

View file

@ -14,7 +14,11 @@ sealed class EventData : Event() {
companion object {
fun deserialize(json: String) = Json.decodeFromString(serializer(), json)
fun deserialize(json: String) = try {
Json.decodeFromString(serializer(), json)
} catch (ignored: Exception) {
Error(System.currentTimeMillis())
}
}
// Mobile <- Wear
@ -234,7 +238,7 @@ sealed class EventData : Event() {
@Serializable // returnCommand is sent back to Mobile after confirmation
data class ConfirmAction(val title: String, val message: String, val returnCommand: EventData?) : EventData()
@Serializable
data class SnoozeAlert(val timeStamp: Long) : EventData()
}