Skip to content

Commit

Permalink
Adds custom message for 404 on model access
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Sep 27, 2023
1 parent a4323ef commit 628dfe0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ai/openaiProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down

0 comments on commit 628dfe0

Please sign in to comment.