(exc: Any)
| 17 | |
| 18 | |
| 19 | def force_bytes(exc: Any) -> bytes: |
| 20 | with contextlib.suppress(TypeError): |
| 21 | return bytes(exc) |
| 22 | with contextlib.suppress(Exception): |
| 23 | return str(exc).encode() |
| 24 | return f'<unprintable {type(exc).__name__} object>'.encode() |
| 25 | |
| 26 | |
| 27 | @contextlib.contextmanager |
no outgoing calls
no test coverage detected