Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 3781868

Browse files
committed
Don't throw an exception on new message from realtime
1 parent e82a354 commit 3781868

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/main/java/com/assemblyai/api/RealtimeTranscriber.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,11 @@ public void onOpen(@NotNull WebSocket webSocket, @NotNull Response response) {
344344
public void onMessage(@NotNull WebSocket webSocket, @NotNull String text) {
345345
try {
346346
RealtimeMessage realtimeMessage = ObjectMappers.JSON_MAPPER.readValue(text, RealtimeMessage.class);
347-
realtimeMessage.visit(realtimeMessageVisitor);
347+
try {
348+
realtimeMessage.visit(realtimeMessageVisitor);
349+
} catch (IllegalStateException ignored) {
350+
// when a new message is added to the API, this should not throw an exception
351+
}
348352
} catch (JsonProcessingException e) {
349353
if (onError == null) return;
350354
onError.accept(e);

0 commit comments

Comments
 (0)