uhd-urz / elAPI

An extensible API client for eLabFTW
GNU Affero General Public License v3.0
5 stars 0 forks source link

Extend exception list - [merged] #81

Closed alexander-haller closed 4 months ago

alexander-haller commented 10 months ago

In GitLab by @mhxion on Jan 31, 2024, 20:34

Merges minor-improvements -> dev

Fixes #12

It might be better if we use base classes for a group of exceptions instead of individual exceptions, depending on the type of exception of course. This PR replaces httpx.ReadTimeout and httpx.ConnectTimeout with httpx.TimeoutException.

The exception hierarchy used by our HTTP library HTTPX is as follows (from site-packages/httpx/_exceptions.py):


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