Skip to content

Add error_callback to ASRProcessor and use it#108

Merged
openminddev merged 2 commits intomainfrom
drop-connection
Mar 9, 2026
Merged

Add error_callback to ASRProcessor and use it#108
openminddev merged 2 commits intomainfrom
drop-connection

Conversation

@openminddev
Copy link
Contributor

Introduce an optional error_callback to ASRProcessor and wire it from ConnectionProcessor so ASR errors can close the corresponding websocket connection. ASRProcessor now stores error_callback, logs and invokes it when the model is not initialized or when an exception occurs during streaming, stops the processor, and re-raises the error. ConnectionProcessor passes a lambda that calls ws_server.close_connection(connection_id) when available. Also adds a running-check inside the response loop and improves logging around errors and stop conditions.

Introduce an optional error_callback to ASRProcessor and wire it from ConnectionProcessor so ASR errors can close the corresponding websocket connection. ASRProcessor now stores error_callback, logs and invokes it when the model is not initialized or when an exception occurs during streaming, stops the processor, and re-raises the error. ConnectionProcessor passes a lambda that calls ws_server.close_connection(connection_id) when available. Also adds a running-check inside the response loop and improves logging around errors and stop conditions.
Update MockASRProcessor in tests/om1_speech/processor to accept an error_callback parameter and store it as self.error_callback. This enables tests to simulate ASR error handling behavior when needed.
@openminddev openminddev merged commit d1f3b0d into main Mar 9, 2026
7 checks passed
@openminddev openminddev deleted the drop-connection branch March 9, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant