fix(deepgram): differentiate auth failures during key validation

This commit is contained in:
Taesun Lee 2025-10-01 13:14:30 +09:00
parent 5e405384d5
commit d7b86645a8
2 changed files with 24 additions and 10 deletions

14
main.js

File diff suppressed because one or more lines are too long

View file

@ -456,10 +456,24 @@ export class DeepgramAdapter implements ITranscriber {
try {
return await this.deepgramService.validateApiKey(key);
} catch (error) {
this.logger.debug('DeepgramAdapter: API key validation failed', {
error: (error as Error).message
const err = error as TranscriptionError;
if (
err instanceof TranscriptionError &&
(err.code === 'AUTH_ERROR' || err.statusCode === 401 || err.statusCode === 403)
) {
this.logger.warn('DeepgramAdapter: API key authentication failed', {
statusCode: err.statusCode
});
return false;
}
this.logger.error('DeepgramAdapter: API key validation error (non-auth)', err, {
statusCode: err?.statusCode,
errorType: err?.constructor?.name
});
return false;
throw error;
}
}