Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 29, 2025

Conversation

dmosc
Copy link
Owner

@dmosc dmosc commented May 29, 2025

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