-
-
Notifications
You must be signed in to change notification settings - Fork 264
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
Improve YouTube API error handling #1199
Improve YouTube API error handling #1199
Conversation
Enhance YouTube API service with comprehensive error handling, retries, and logging to improve reliability. Add typed YouTubeError interface, implement exponential backoff with jitter, properly handle rate limits (429) and quota exceeded (403), and improve cache key management.
📦 🤖 A new release has been made for this pull request.To play around with this PR, pull Images are available for x86_64 and ARM64.
|
lint 2
lint 3
lint 4
lint 5
lint 5
Addressed type and linting errors. All checks passing. Tested changes locally. Ready for review :) |
const error = new Error(message) as YouTubeError; | ||
error.code = code; | ||
error.status = status; | ||
error.retryable = code === 'NETWORK_ERROR' || (status ? status >= 500 : false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we treat HTTP 403 as retry-able?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A 403 forbidden generally won't resolve with a retry, since it's due to invalid API key, geo restriction, or exceeding daily API quota
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one question left on retries, nice PR.
Oh and if you add a line in the changelog we can push a smaller release, as there's not been a release for a while.
This reverts commit 373e6a5.
🚀 Released in Release v2.10.1. |
This PR enhances how the bot handles YouTube API issues by adding better error handling, retries, and user feedback. The main improvements are:
YouTubeError
interfaceI updated
youtube-api.ts
, centralizing error handling in a newexecuteYouTubeRequest
method that all YouTube API calls use. This makes our error handling more consistent and makes the bot more resilient to API issues.Users will now see clearer messages like:
Testing Notes
The key things to test are:
Thanks!