diff --git a/cmd/analyze/analyze.go b/cmd/analyze/analyze.go index bd924d403c..5cccc665a5 100644 --- a/cmd/analyze/analyze.go +++ b/cmd/analyze/analyze.go @@ -104,6 +104,11 @@ var AnalyzeCmd = &cobra.Command{ if explain { parsedText, err := analyzer.ParseViaAI(ctx, aiClient, analysis.Error, nocache) if err != nil { + // Check for exhaustion + if strings.Contains(err.Error(), "status code: 429") { + color.Red("Exhausted API quota. Please try again later") + os.Exit(1) + } color.Red("Error: %v", err) continue } diff --git a/pkg/analyzer/analyzer.go b/pkg/analyzer/analyzer.go index 1bfde58d7e..c5bd24a2dd 100644 --- a/pkg/analyzer/analyzer.go +++ b/pkg/analyzer/analyzer.go @@ -61,7 +61,7 @@ func ParseViaAI(ctx context.Context, aiClient ai.IAI, prompt []string, response, err := aiClient.GetCompletion(ctx, inputKey) if err != nil { color.Red("error getting completion: %v", err) - return "", nil + return "", err } if !viper.IsSet(sEnc) {