Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] More fine grained network exceptions #3778

Closed
11 of 28 tasks
Bibo-Joshi opened this issue Jun 26, 2023 · 0 comments · Fixed by #3792
Closed
11 of 28 tasks

[FEATURE] More fine grained network exceptions #3778

Bibo-Joshi opened this issue Jun 26, 2023 · 0 comments · Fixed by #3792

Comments

@Bibo-Joshi
Copy link
Member

What kind of feature are you missing? Where do you notice a shortcoming of PTB?

We currently only have NetworkError and TimeoutError(NetworkError) to indicate exceptions that are due to natworking problems (in contrast to exceptions issued by TG). This is not very fine grained and can make advanced exception handling difficult.

Describe the solution you'd like

I'd like to add more subclasses. Looking it httpx, they have a large number of them. Not all of them add much value for us IMO. In the following I list all of the httpx excetpions and check the ones that I think would make sense to have for us:

  • HTTPError
    • RequestError
      • TransportError
        • TimeoutException ( (corresponds to tg.TimeoutError)
          • ConnectTimeout
          • ReadTimeout
          • WriteTimeout
          • PoolTimeout
        • NetworkError (corresponds to tg.NetworkError)
          • ConnectError
          • ReadError
          • WriteError
          • CloseError
        • ProtocolError
          • LocalProtocolError
          • RemoteProtocolError
        • ProxyError
        • UnsupportedProtocol
      • DecodingError
      • TooManyRedirects
    • HTTPStatusError
  • InvalidURL
  • CookieConflict
  • StreamError
    • StreamConsumed
    • StreamClosed
    • ResponseNotRead
    • RequestNotRead

Describe alternatives you've considered

No response

Additional context

No response

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant