MCPcopy Create free account
hub / github.com/EasyIME/PIME / _ExceptionLoggingContext

Class _ExceptionLoggingContext

python/python3/tornado/http1connection.py:47–68  ·  view source on GitHub ↗

Used with the ``with`` statement when calling delegate methods to log any exceptions with the given logger. Any exceptions caught are converted to _QuietException

Source from the content-addressed store, hash-verified

45
46
47class _ExceptionLoggingContext(object):
48 """Used with the ``with`` statement when calling delegate methods to
49 log any exceptions with the given logger. Any exceptions caught are
50 converted to _QuietException
51 """
52
53 def __init__(self, logger: logging.Logger) -> None:
54 self.logger = logger
55
56 def __enter__(self) -> None:
57 pass
58
59 def __exit__(
60 self,
61 typ: "Optional[Type[BaseException]]",
62 value: Optional[BaseException],
63 tb: types.TracebackType,
64 ) -> None:
65 if value is not None:
66 assert typ is not None
67 self.logger.error("Uncaught exception", exc_info=(typ, value, tb))
68 raise _QuietException
69
70
71class HTTP1ConnectionParameters(object):

Callers 4

_read_messageMethod · 0.85
_read_fixed_bodyMethod · 0.85
_read_chunked_bodyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected