fix(core): guard the only redact() call in transcribe() so it truly cannot throw

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:49:12 +04:00
parent b38e160073
commit 812ace7f3c

View File

@ -130,11 +130,15 @@ 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', redact(`внутренняя ошибка: ${errorText(e)}`, { apiKey, boundary })); result = fail('temporary', `внутренняя ошибка: ${errorText(e)}`);
}
if (result.ok) return result;
try {
return { ...result, message: redact(result.message, { apiKey, boundary }) };
} catch {
return { ...result, message: 'внутренняя ошибка' };
} }
return result;
} }
private request( private request(