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

add httpx.ReadError handlers and throw them as OfflineException #47

Open
RTUnreal opened this issue Jul 21, 2024 · 5 comments
Open

add httpx.ReadError handlers and throw them as OfflineException #47

RTUnreal opened this issue Jul 21, 2024 · 5 comments

Comments

@RTUnreal
Copy link

No description provided.

@RTUnreal RTUnreal changed the title add httpx.ConnectTimeout, httpx.NetworkError and httpx.PoolTimeout handlers and throw them as OfflineException add httpx.ReadError handlers and throw them as OfflineException Jul 21, 2024
@RTUnreal
Copy link
Author

RTUnreal commented Jul 21, 2024

I have checked the source code and concluded, the other exceptions where caught, but the ReadError was not. Should we make it more general and catch all httpx.NetworkErrors as OfflineExceptions @ldruschk?

I also think there were some issues with PoolTimeouts, but personally I didn't got these. @a-miscellaneous, can you tell which Exceptions were also not caught, but should be by the enochecker3?

@ldruschk
Copy link
Member

I wanted to avoid catching too broad exceptions, to avoid masking checker errors that should be dealt with explicitly by checker authors (these should lead to checker errors when not explicitly handled). We should review the httpx-Exceptions and determine which are generic enogh to catch in the checker lib

@RTUnreal
Copy link
Author

RTUnreal commented Jul 21, 2024

here is the tree of exceptions: https://www.python-httpx.org/exceptions/

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

@a-miscellaneous
Copy link

IMO, the general issue is that the common use-case is not met. currently all errors are thrown as internal exceptions which is obviously not the case. Hence most would write a wrapper to handle exceptions, I personally got inspired by underleaf.

@RTUnreal
Copy link
Author

tbh, that is a bit of a horrible way of dealing with exceptions. If a unintended exception occurs, then it should be handled like a checker error. And if there are more 'generic' Exceptions, then it should be dealt with as the correct exception.

@ldruschk ldruschk moved this to Ready in Enowars 8 aftermath Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready
Development

No branches or pull requests

3 participants