question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to Catch ApiRequestException for 429 (Too Many Requests)

See original GitHub issue

I found a bug to report

Please use the following template to ensure maintainers can reproduce the bug and solve it quickly.

Bug reports that do not follow this template will be kept closed because not-reproducible until the creator edits the post properly.

Steps to reproduce

try
{
    // Send 100 text messages to a group chat
    for (int i = 0; i < 100; i++)
        await Bot.SendTextMessageAsync(chatId, "Hello");
}

catch (ApiRequestException e)
{
    // Retry after the wait time
    await Task.Delay(e.Parameters.RetryAfter);
    await Bot.SendTextMessageAsync(chatId, "Hello");
}

Expected behavior

I expect to catch ApiRequestException so that I can get the retry_after ResponseParameter.

Actual behavior

HttpRequestException is thrown, which doesn’t include the retry_after ResponseParameter. So I have no way of knowing how long I should wait before retrying.

Screenshots

Screenshot

изображение

Environment data

NuGet Package Version: 15.5.1

.NET Version: 4.7.2

IDE: VS2019

App: Console

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
tuscencommented, May 16, 2020

@kirsan31 It will be fixed only in the next major release since fixing it is a breaking change in terms of runtime behaviour. You’ll have to wait for it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix 429 Too Many Requests Error
The HTTP 429 error is returned when too many requests are made to a page within a short period of time. Find out...
Read more >
Telegram bot api: Error code 429, Error: Too many requests
Based on the Telegram Bots FAQ for sending messages, you should consider this: If you're sending bulk notifications to multiple users, the API ......
Read more >
What Does HTTP Error 429: Too Many Requests Mean? ...
HTTP Error 429 is an HTTP response status code that indicates the client application has surpassed its rate limit, or number of requests...
Read more >
How to Fix 429 Too Many Requests Error Code: 6 Methods
How to Fix the 429 Too Many Requests Error Code · 1. Flush Cache · 2. Check Your Order Usage on hPanel ·...
Read more >
429 Error – Too Many Requests HTTP Code Explained
It means that the website can't handle the number of requests being sent to it. For a developer, this error can be hard...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found