Beginner
One retry, only for the right errors
Write call_with_one_retry(call). call is a function with no arguments that returns text or raises an error.
Call it. If it raises RateLimitError or TimeoutError, call it once more. If the second call also raises one of those, return "Sorry, try again later.". Any other error must not be retried: let it propagate.
What Check tests
- A successful call returns its text
- Retries once after a rate limit
- Two failures give the fallback message
- Other errors are not retried
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.