Skip to content

Commit

Permalink
Don't throw an exception on new message from realtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Swimburger committed Apr 15, 2024
1 parent e82a354 commit 3781868
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/assemblyai/api/RealtimeTranscriber.java
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,11 @@ public void onOpen(@NotNull WebSocket webSocket, @NotNull Response response) {
public void onMessage(@NotNull WebSocket webSocket, @NotNull String text) {
try {
RealtimeMessage realtimeMessage = ObjectMappers.JSON_MAPPER.readValue(text, RealtimeMessage.class);
realtimeMessage.visit(realtimeMessageVisitor);
try {
realtimeMessage.visit(realtimeMessageVisitor);
} catch (IllegalStateException ignored) {
// when a new message is added to the API, this should not throw an exception
}
} catch (JsonProcessingException e) {
if (onError == null) return;
onError.accept(e);
Expand Down

0 comments on commit 3781868

Please sign in to comment.