Skip to content
Myr

exceptions.py

This file

Path

http3/exceptions.py

135 lines · 2.2 KiB · Python

Last changed by

Check for connection aliveness on pool re-acquiry (#111)Tom Christiebefore adoption025240c

History of this file

Take it

1# Timeout exceptions...234class Timeout(Exception):5    """6    A base class for all timeouts.7    """8910class ConnectTimeout(Timeout):11    """12    Timeout while establishing a connection.13    """141516class ReadTimeout(Timeout):17    """18    Timeout while reading response data.19    """202122class WriteTimeout(Timeout):23    """24    Timeout while writing request data.25    """262728class PoolTimeout(Timeout):29    """30    Timeout while waiting to acquire a connection from the pool.31    """323334# HTTP exceptions...353637class NotConnected(Exception):38    """39    A connection was lost at the point of starting a request,40    prior to any writes succeeding.41    """424344class HttpError(Exception):45    """46    An HTTP error occurred.47    """484950class ProtocolError(Exception):51    """52    Malformed HTTP.53    """545556class DecodingError(Exception):57    """58    Decoding of the response failed.59    """606162# Redirect exceptions...636465class RedirectError(Exception):66    """67    Base class for HTTP redirect errors.68    """697071class TooManyRedirects(RedirectError):72    """73    Too many redirects.74    """757677class RedirectBodyUnavailable(RedirectError):78    """79    Got a redirect response, but the request body was streaming, and is80    no longer available.81    """828384class RedirectLoop(RedirectError):85    """86    Infinite redirect loop.87    """888990# Stream exceptions...919293class StreamException(Exception):94    """95    The base class for stream exceptions.9697    The developer made an error in accessing the request stream in98    an invalid way.99    """100101102class StreamConsumed(StreamException):103    """104    Attempted to read or stream response content, but the content has already105    been streamed.106    """107108109class ResponseNotRead(StreamException):110    """111    Attempted to access response content, without having called `read()`112    after a streaming response.113    """114115116class ResponseClosed(StreamException):117    """118    Attempted to read or stream response content, but the request has been119    closed.120    """121122123# Other cases...124125126class InvalidURL(Exception):127    """128    URL was missing a hostname, or was not one of HTTP/HTTPS.129    """130131132class CookieConflict(Exception):133    """134    Attempted to lookup a cookie by name, but multiple cookies existed.135    """