Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.0.0-patch-1] - 2026-03-16

- Gracefully handle unknown message types

## [5.0.0] - 2025-08-14

- Moved channel field to root of AddTranscript message for multichannel transcription.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0
5.0.0-patch-1
15 changes: 9 additions & 6 deletions speechmatics/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,15 @@ def _consumer(self, message):
message = json.loads(message)
message_type = message["message"]

for handler in self.event_handlers[message_type]:
try:
handler(copy.deepcopy(message))
except ForceEndSession:
LOGGER.warning("Session was ended forcefully by an event handler")
raise
try:
for handler in self.event_handlers[message_type]:
try:
handler(copy.deepcopy(message))
except ForceEndSession:
LOGGER.warning("Session was ended forcefully by an event handler")
raise
except KeyError as kex:
LOGGER.debug(f"Unknown handler for message type: {message_type} {kex=}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably log an error instead


if message_type == ServerMessageType.RecognitionStarted:
self._flag_recognition_started()
Expand Down
Loading