Built-in Exceptions
ConnectionResetError — exception class
An established connection was reset by the peer or network stack. Discard the unusable stream and consider whether partial data or side effects make a retry unsafe. The example uses the symbolic errno.ECONNRESET to demonstrate CPython exception selection without accessing an external system. The example raises a controlled stand-in to demonstrate handling; it does not cause the real system failure. Catch ConnectionResetError when this category is the recovery boundary; do not rely on the exact human-readable message.
Formal Syntax & Structure
python syntaxpython
ConnectionResetErrorReturn Value
type
The class object ConnectionResetError; this reference documents the class identity, not a universal constructor signature.
Working Example
Example Snippetpython
import errnotry: raise OSError(errno.ECONNRESET,"demo")except ConnectionResetError as error: print(type(error).__name__)