Skip to content

Commit 2ab5616

Browse files
committed
fix: tests
1 parent c60a9d1 commit 2ab5616

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

templates/android/library/src/main/java/io/package/services/Realtime.kt.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ class Realtime(client: Client) : Service(client), CoroutineScope {
181181
}
182182

183183
private fun handleResponseError(message: RealtimeResponse) {
184-
throw message.data.jsonCast<{{ spec.title | caseUcfirst }}Exception>()
184+
throw message.data?.jsonCast<{{ spec.title | caseUcfirst }}Exception>() ?: RuntimeException("data is not present")
185185
}
186186

187187
private suspend fun handleResponseEvent(message: RealtimeResponse) {
188-
val event = message.data.jsonCast<RealtimeResponseEvent<Any>>()
188+
val event = message.data?.jsonCast<RealtimeResponseEvent<Any>>() ?: return
189189
if (event.channels.isEmpty()) {
190190
return
191191
}

0 commit comments

Comments
 (0)