Skip to content
Myr

exceptions.py

This file

Path

httpcore/exceptions.py

122 lines · 1.9 KiB · Python

Last changed by

Merge pull request #39 from matusf/29-add-raise_for_statusTom Christiebefore adoption5c1cb30

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 HttpError(Exception):38    """39    An Http error occurred.40    """414243class ProtocolError(Exception):44    """45    Malformed HTTP.46    """474849class DecodingError(Exception):50    """51    Decoding of the response failed.52    """535455# Redirect exceptions...565758class RedirectError(Exception):59    """60    Base class for HTTP redirect errors.61    """626364class TooManyRedirects(RedirectError):65    """66    Too many redirects.67    """686970class RedirectBodyUnavailable(RedirectError):71    """72    Got a redirect response, but the request body was streaming, and is73    no longer available.74    """757677class RedirectLoop(RedirectError):78    """79    Infinite redirect loop.80    """818283# Stream exceptions...848586class StreamException(Exception):87    """88    The base class for stream exceptions.8990    The developer made an error in accessing the request stream in91    an invalid way.92    """939495class StreamConsumed(StreamException):96    """97    Attempted to read or stream response content, but the content has already98    been streamed.99    """100101102class ResponseNotRead(StreamException):103    """104    Attempted to access response content, without having called `read()`105    after a streaming response.106    """107108109class ResponseClosed(StreamException):110    """111    Attempted to read or stream response content, but the request has been112    closed.113    """114115116# Other cases...117118119class InvalidURL(Exception):120    """121    URL was missing a hostname, or was not one of HTTP/HTTPS.122    """