fix(core): wrap redact() in transcribe()'s try/catch so it never throws

Refs #5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QKHeGuAYh4W1jNdjMConZa
This commit is contained in:
Andrey Epifancev 2026-09-28 00:46:02 +04:00
parent 06d3528efd
commit b38e160073

View File

@ -130,10 +130,11 @@ export class OpenAiTranscriber implements Transcriber {
apiKey = s.apiKey; apiKey = s.apiKey;
boundary = makeBoundary(this.random); boundary = makeBoundary(this.random);
result = await this.request(s, audio, mime, signal, boundary); result = await this.request(s, audio, mime, signal, boundary);
if (!result.ok) result = { ...result, message: redact(result.message, { apiKey, boundary }) };
} catch (e) { } catch (e) {
result = fail('temporary', `внутренняя ошибка: ${errorText(e)}`); result = fail('temporary', redact(`внутренняя ошибка: ${errorText(e)}`, { apiKey, boundary }));
} }
return result.ok ? result : { ...result, message: redact(result.message, { apiKey, boundary }) }; return result;
} }
private request( private request(