summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/proactor_events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-02-19 00:40:41 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-02-19 00:40:41 (GMT)
commit0ee29c2c7fbc7e1b10e153b0cb59d2270347d4f3 (patch)
treea12bfe6a1d42c325134ca0a245cce8e96aa9a641 /Lib/asyncio/proactor_events.py
parent3cb9914488d2d5c95a1b688a68302f5fa2e914ad (diff)
downloadcpython-0ee29c2c7fbc7e1b10e153b0cb59d2270347d4f3.zip
cpython-0ee29c2c7fbc7e1b10e153b0cb59d2270347d4f3.tar.gz
cpython-0ee29c2c7fbc7e1b10e153b0cb59d2270347d4f3.tar.bz2
asyncio, Tulip issue 139: Improve error messages on "fatal errors"
Mention if the error was caused by a read or a write, and be more specific on the object (ex: "pipe transport" instead of "transport").
Diffstat (limited to 'Lib/asyncio/proactor_events.py')
-rw-r--r--Lib/asyncio/proactor_events.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index d72f927..f45cd9c 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -53,10 +53,10 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin,
if self._read_fut is not None:
self._read_fut.cancel()
- def _fatal_error(self, exc):
+ def _fatal_error(self, exc, message='Fatal error on pipe transport'):
if not isinstance(exc, (BrokenPipeError, ConnectionResetError)):
self._loop.call_exception_handler({
- 'message': 'Fatal transport error',
+ 'message': message,
'exception': exc,
'transport': self,
'protocol': self._protocol,
@@ -151,11 +151,11 @@ class _ProactorReadPipeTransport(_ProactorBasePipeTransport,
self._read_fut = self._loop._proactor.recv(self._sock, 4096)
except ConnectionAbortedError as exc:
if not self._closing:
- self._fatal_error(exc)
+ self._fatal_error(exc, 'Fatal read error on pipe transport')
except ConnectionResetError as exc:
self._force_close(exc)
except OSError as exc:
- self._fatal_error(exc)
+ self._fatal_error(exc, 'Fatal read error on pipe transport')
except futures.CancelledError:
if not self._closing:
raise
@@ -246,7 +246,7 @@ class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport,
except ConnectionResetError as exc:
self._force_close(exc)
except OSError as exc:
- self._fatal_error(exc)
+ self._fatal_error(exc, 'Fatal write error on pipe transport')
def can_write_eof(self):
return True