connection.py: Properly catch all network errors.