Open dmikushin opened 2 years ago
Just now, 3 variations spontaneously come to my mind. The first would be to make your own derived class and handle the error that way. Like you did it. Or you could automatically ignore certain errors directly in the library so that they are never thrown. But then it could be that someone would like to handle this error instead of ignoring it. Or the user can use some function to specify which errors should (not) be thrown or how extensively errors should be thrown. Now the question is, what makes the most sense or if there are other better options?
Dear TgBot authors, greetings,
Here is a feedback from using TgBot in a production workload. Once in every few hours I get timeout of the http resuest, like this:
In the present code design, everything what is not an OK status throws an exception:
I'm not sure whether the timeout is caused by network oddities, or by the Telegram server behavior. In any case, timeout should be an expected event. For this reason, throwing an exception is this case seems to be a doubtful design. In order to handle the timeout, one needs to derive another HttpRequest class and silence the exception, for example like this:
I don't have any alternative suggestion, atm. Could you please share your thoughts and experiences? Thanks!