Used with the ``with`` statement when calling delegate methods to log any exceptions with the given logger. Any exceptions caught are converted to _QuietException
| 45 | |
| 46 | |
| 47 | class _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 | |
| 71 | class HTTP1ConnectionParameters(object): |
no outgoing calls
no test coverage detected