Show transcription start errors in UI, improve error logging
Start Transcription button now shows the error message when it fails instead of silently reverting. Common causes: - Missing PortAudio library on Linux - Audio device not accessible - Deepgram connection failure Also added error details to backend console output and captured the last error from the Deepgram engine for better diagnostics. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -396,7 +396,14 @@ class AppController:
|
|||||||
try:
|
try:
|
||||||
success = self.transcription_engine.start_recording()
|
success = self.transcription_engine.start_recording()
|
||||||
if not success:
|
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
|
# Start server sync if enabled
|
||||||
if self.config.get('server_sync.enabled', False):
|
if self.config.get('server_sync.enabled', False):
|
||||||
|
|||||||
@@ -167,6 +167,8 @@ class DeepgramTranscriptionEngine:
|
|||||||
self._start_audio_stream()
|
self._start_audio_stream()
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.error("Failed to open audio stream: %s", 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._is_recording = False
|
||||||
self._stop_event.set()
|
self._stop_event.set()
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -8,9 +8,12 @@
|
|||||||
);
|
);
|
||||||
let isLoading = $state(false);
|
let isLoading = $state(false);
|
||||||
|
|
||||||
|
let errorMessage = $state("");
|
||||||
|
|
||||||
async function toggleTranscription() {
|
async function toggleTranscription() {
|
||||||
if (isLoading) return;
|
if (isLoading) return;
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
|
errorMessage = "";
|
||||||
try {
|
try {
|
||||||
if (isTranscribing) {
|
if (isTranscribing) {
|
||||||
await backendStore.apiPost("/api/stop");
|
await backendStore.apiPost("/api/stop");
|
||||||
@@ -20,8 +23,10 @@
|
|||||||
// Poll status to update UI immediately instead of waiting
|
// Poll status to update UI immediately instead of waiting
|
||||||
// for WebSocket broadcast (which can be delayed or missed)
|
// for WebSocket broadcast (which can be delayed or missed)
|
||||||
await backendStore.pollStatus();
|
await backendStore.pollStatus();
|
||||||
} catch (err) {
|
} catch (err: unknown) {
|
||||||
console.error("Failed to toggle transcription:", err);
|
const msg = err instanceof Error ? err.message : String(err);
|
||||||
|
console.error("Failed to toggle transcription:", msg);
|
||||||
|
errorMessage = msg;
|
||||||
} finally {
|
} finally {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
}
|
}
|
||||||
@@ -104,9 +109,19 @@
|
|||||||
<button onclick={saveTranscriptions} disabled={!backendStore.connected}>
|
<button onclick={saveTranscriptions} disabled={!backendStore.connected}>
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
{#if errorMessage}
|
||||||
|
<span class="error-msg">{errorMessage}</span>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.error-msg {
|
||||||
|
color: #f44336;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.controls {
|
.controls {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
Reference in New Issue
Block a user