Skip to content
Myr

exceptions.py

This file

Path

httpcore/exceptions.py

122 lines · 1.9 KiB · Python

Last changed by

Add `HttpError`Matus Ferechbefore adoption2197015

History of this file

Take it

Rejig test and tighten up models APITom Christiebefore adoptiondea4d42

lines 1–3why, one step back
1# Timeout exceptions...
23

StuffTom Christiebefore adoption30530d4

lines 4–21why, one step back
4class 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 """2021

Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054

lines 22–27why, one step back
22class WriteTimeout(Timeout):
23 """24 Timeout while writing request data.25 """2627

StuffTom Christiebefore adoption30530d4

lines 28–33why, one step back
28class PoolTimeout(Timeout):
29 """30 Timeout while waiting to acquire a connection from the pool.31 """3233

Rejig test and tighten up models APITom Christiebefore adoptiondea4d42

lines 34–36why, one step back
34# HTTP exceptions...
3536

Add `HttpError`Matus Ferechbefore adoption2197015

lines 37–42why, one step back
37class HttpError(Exception):
38 """39 An Http error occurred.40 """4142

Rejig test and tighten up models APITom Christiebefore adoptiondea4d42

lines 43–48why, one step back
43class ProtocolError(Exception):
44 """45 Malformed HTTP.46 """4748

Updating docstringsTom Christiebefore adoption5f8000f

lines 49–54why, one step back
49class DecodingError(Exception):
50 """51 Decoding of the response failed.52 """5354

Rejig test and tighten up models APITom Christiebefore adoptiondea4d42

lines 55–57why, one step back
55# Redirect exceptions...
5657

Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054

lines 58–82why, one step back
58class 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 """8182

Updating docstringsTom Christiebefore adoption5f8000f

line 83why, one step back
83# Stream exceptions...

StuffTom Christiebefore adoption30530d4

lines 84–85why, one step back
84
85

Updating docstringsTom Christiebefore adoption5f8000f

line 86why, one step back
86class StreamException(Exception):

StuffTom Christiebefore adoption30530d4

line 87why, one step back
87 """

Updating docstringsTom Christiebefore adoption5f8000f

lines 88–96why, one step back
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 """

StuffTom Christiebefore adoption30530d4

lines 97–101why, one step back
97 Attempted to read or stream response content, but the content has already
98 been streamed.99 """100101

Updating docstringsTom Christiebefore adoption5f8000f

line 102why, one step back
102class ResponseNotRead(StreamException):

Response.contentTom Christiebefore adoption4c55113

lines 103–108why, one step back
103 """
104 Attempted to access response content, without having called `read()`105 after a streaming response.106 """107108

Updating docstringsTom Christiebefore adoption5f8000f

line 109why, one step back
109class ResponseClosed(StreamException):

StuffTom Christiebefore adoption30530d4

lines 110–111why, one step back
110 """
111 Attempted to read or stream response content, but the request has been

Updating docstringsTom Christiebefore adoption5f8000f

line 112why, one step back
112 closed.

Merge pull request #20 from yeraydiazdiaz/decoding-exceptionsTom Christiebefore adoption2b134a6

line 113why, one step back
113 """

Response.contentTom Christiebefore adoption4c55113

lines 114–116why, one step back
114
115116# Other cases...

Merge pull request #20 from yeraydiazdiaz/decoding-exceptionsTom Christiebefore adoption2b134a6

line 117why, one step back
117

response.next()Tom Christiebefore adoptiond652479

line 118why, one step back
118

Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054

lines 119–120why, one step back
119class InvalidURL(Exception):
120 """

Merge pull request #20 from yeraydiazdiaz/decoding-exceptionsTom Christiebefore adoption2b134a6

line 121why, one step back
121 URL was missing a hostname, or was not one of HTTP/HTTPS.

StuffTom Christiebefore adoption30530d4

line 122why, one step back
122 """