#nobody_best-practices

1 messages · Page 1 of 1 (latest)

icy hedgeBOT
#

👋 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.

rain jackal
#

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?

red frost
#

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

rain jackal
#

Apologies, I'm using python

red frost
rain jackal
#

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

red frost
#

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.

GitHub

Python library for the Stripe API. . Contribute to stripe/stripe-python development by creating an account on GitHub.

Learn how to understand errors at the HTTP level.

rain jackal
#

Ohh okay so when stripe.error.RateLimitError occurs, Stripe-Should-Retry is false?

red frost
#

Yup! Stripe-Should-Retry is false for RateLimitError

rain jackal
#

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

red frost
#

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

Catch and respond to declines, invalid data, network problems, and more.

rain jackal
#

Awesome, thanks for the help man