From 628dfe0d37480840be4beaeae116bf3e19afadf8 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 27 Sep 2023 18:32:03 -0400 Subject: [PATCH] Adds custom message for 404 on model access --- src/ai/openaiProvider.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ai/openaiProvider.ts b/src/ai/openaiProvider.ts index dd25a78..65eb1c4 100644 --- a/src/ai/openaiProvider.ts +++ b/src/ai/openaiProvider.ts @@ -142,6 +142,11 @@ export class OpenAIProvider implements AIProvider { if (!rsp.ok) { debugger; + if (rsp.status === 404) { + throw new Error( + `Unable to explain commit: Your API key doesn't seem to have access to the selected '${model}' model`, + ); + } if (rsp.status === 429) { throw new Error( `Unable to explain commit: (${this.name}:${rsp.status}) Too many requests (rate limit exceeded) or your API key is associated with an expired trial`,