#nobody_best-practices
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1288683491759755274
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- nobody_unexpected, 1 day ago, 33 messages
These approaches seem a bit opposing as well. If your stripe call is in a try/catch and a 429 exception occurs, you wouldn't have received an object back from the stripe call to check the headers on, right?
Are you using stripe official libraries? if so, which library/language do you use? Stripe libraries will throw relevant exceptions, so that you can retry again later instead of inspecting status code or Stripe-Should-Retry header
Apologies, I'm using python
Thanks for sharing! For stripe-python, stripe.error.RateLimitError exception will be thrown. You can catch this exception and retry again with an exponential backoff schedule: https://docs.stripe.com/error-handling?lang=python#rate-limit-errors
Yeah I was gonna catch that one. But how do i know if there aren't other exceptions i should retry on? That's why i was wondering if I should look at Stripe-Should-Retry instead
Stripe libraries have taken Stripe-Should-Retry into consideration. If your system configures automatic retry (https://github.com/stripe/stripe-python/tree/master?tab=readme-ov-file#configuring-automatic-retries), Stripe will retry the request again when Stripe-Should-Retry becomes true.
This has been explained in https://docs.stripe.com/error-low-level#should-retry:
The retry mechanisms built into Stripe’s client libraries respect Stripe-Should-Retry automatically. If you’re using one of them, you don’t need to handle it manually.
Ohh okay so when stripe.error.RateLimitError occurs, Stripe-Should-Retry is false?
Yup! Stripe-Should-Retry is false for RateLimitError
Thxx it makes sense now. It would help if it says this in the docs, because I perceived this as two separate ways to error handle
I guess it kinda did say it but it wasnt explicit, maybe im dumb
Thanks for sharing the feedback. I'll forward this to see how we can make it clearer. At the high level when using stripe libraries, you only need to look at the error handling for this specific library: https://docs.stripe.com/error-handling
Low-level handling is for developers who use HTTP directly instead of stripe libraries
Awesome, thanks for the help man