diff --git a/backend/app_controller.py b/backend/app_controller.py index d45d1bc..d5265b1 100644 --- a/backend/app_controller.py +++ b/backend/app_controller.py @@ -396,7 +396,14 @@ class AppController: try: success = self.transcription_engine.start_recording() if not success: - return False, "Failed to start recording" + import logging + # Check if there's a recent error in the logger + err_detail = getattr(self.transcription_engine, '_last_error', '') + msg = f"Failed to start recording" + if err_detail: + msg += f": {err_detail}" + print(f"ERROR: {msg}") + return False, msg # Start server sync if enabled if self.config.get('server_sync.enabled', False): diff --git a/client/deepgram_transcription.py b/client/deepgram_transcription.py index ec49bad..68b05a5 100644 --- a/client/deepgram_transcription.py +++ b/client/deepgram_transcription.py @@ -167,6 +167,8 @@ class DeepgramTranscriptionEngine: self._start_audio_stream() except Exception as exc: logger.error("Failed to open audio stream: %s", exc) + print(f"ERROR: Failed to open audio stream: {exc}") + self._last_error = f"Audio stream error: {exc}" self._is_recording = False self._stop_event.set() return False diff --git a/src/lib/components/Controls.svelte b/src/lib/components/Controls.svelte index 0a52ad8..987ace0 100644 --- a/src/lib/components/Controls.svelte +++ b/src/lib/components/Controls.svelte @@ -8,9 +8,12 @@ ); let isLoading = $state(false); + let errorMessage = $state(""); + async function toggleTranscription() { if (isLoading) return; isLoading = true; + errorMessage = ""; try { if (isTranscribing) { await backendStore.apiPost("/api/stop"); @@ -20,8 +23,10 @@ // Poll status to update UI immediately instead of waiting // for WebSocket broadcast (which can be delayed or missed) await backendStore.pollStatus(); - } catch (err) { - console.error("Failed to toggle transcription:", err); + } catch (err: unknown) { + const msg = err instanceof Error ? err.message : String(err); + console.error("Failed to toggle transcription:", msg); + errorMessage = msg; } finally { isLoading = false; } @@ -104,9 +109,19 @@ + + {#if errorMessage} + {errorMessage} + {/if}