Skip to content

feat: Add warning for OpenAI quota exhaustion and exit gracefully#83

Merged
dmosc merged 2 commits into
mainfrom
feat/handle-openai-quota-error
May 29, 2025
Merged

feat: Add warning for OpenAI quota exhaustion and exit gracefully#83
dmosc merged 2 commits into
mainfrom
feat/handle-openai-quota-error

Conversation

@dmosc

@dmosc dmosc commented May 29, 2025

Copy link
Copy Markdown
Owner

Instead of crashing, the application now detects potential OpenAI API quota exhaustion errors (specifically, a 429 status code).

When such an error is detected:

  1. A warning message is logged to the console (e.g., "You may have exceeded your OpenAI API quota or rate limit. Please check your OpenAI account.").
  2. The application then prints an informational message and exits gracefully.

This was achieved by:

  • Adding a logger::warn function for warning messages.
  • Modifying gpt_client::async_query to check for the 429 status code. If detected, it logs the warning and returns Ok(serde_json::Value::Null).
  • Updating main to check for this Null value and exit cleanly if it's received.

closes #33

google-labs-jules Bot and others added 2 commits May 29, 2025 02:29
Instead of crashing, the application now detects potential OpenAI API quota
exhaustion errors (specifically, a 429 status code).

When such an error is detected:
1. A warning message is logged to the console (e.g., "You may have
   exceeded your OpenAI API quota or rate limit. Please check your
   OpenAI account.").
2. The application then prints an informational message and exits
   gracefully.

This was achieved by:
- Adding a `logger::warn` function for warning messages.
- Modifying `gpt_client::async_query` to check for the 429 status
  code. If detected, it logs the warning and returns
  `Ok(serde_json::Value::Null)`.
- Updating `main` to check for this `Null` value and exit cleanly if it's
  received.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warn when user has no quota

1 participant