Python 3.3+Exceptionsexception
ConnectionAbortedError
built-in exceptions
The connection was aborted by the host (a subclass of ConnectionError).
Syntax
raise ConnectionAbortedError
This maps to the ECONNABORTED errno: the connection fell apart while it was still being established, and it typically pops out of a server's accept() call — noticeably more often on Windows than on Linux. The right response is not to let the server die but to catch it inside the accept loop, drop that one half-open connection and keep serving the rest.
Examples
try:
raise ConnectionAbortedError
except ConnectionAbortedError as e:
print(type(e).__name__) # → ConnectionAbortedError
See also
Open in the full glossarydocs.python.orgReport an inaccuracy