Skip to content

Commit 3d26add

Browse files
committed
[AI] Improve error messaging for LiveServerMessageSerializer
The error message should include the actual content of the message that couldn't be de-serialized instead of class around java class names, which are not useful before de-serialization succeds.
1 parent b03038d commit 3d26add

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/LiveServerMessage.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,7 @@ internal object LiveServerMessageSerializer :
181181
"toolCall" in jsonObject -> LiveServerToolCall.InternalWrapper.serializer()
182182
"toolCallCancellation" in jsonObject ->
183183
LiveServerToolCallCancellation.InternalWrapper.serializer()
184-
else ->
185-
throw SerializationException(
186-
"The given subclass of LiveServerMessage (${javaClass.simpleName}) is not supported in the serialization yet."
187-
)
184+
else -> throw SerializationException("Unknown LiveServerMessage response type: $jsonObject.")
188185
}
189186
}
190187
}

0 commit comments

Comments
 (0)