Built-in Exceptions
ConnectionError — exception class
Base for connection-specific operating-system failures, including broken pipes, refusal, reset and abort. Distinguish these from application protocol failures such as an HTTP status response. Retry only when the operation can safely be repeated. The example raises a controlled stand-in to demonstrate handling; it does not cause the real system failure. Catch ConnectionError when this category is the recovery boundary; do not rely on the exact human-readable message.
Formal Syntax & Structure
python syntaxpython
ConnectionErrorReturn Value
type
The class object ConnectionError; this reference documents the class identity, not a universal constructor signature.
Working Example
Example Snippetpython
import errnotry: raise OSError(errno.ECONNRESET,"reset")except ConnectionError as error: print(type(error).__name__)