(exc: Exception, max_depth: int = 10)
| 25 | |
| 26 | |
| 27 | def get_errno_from_chain(exc: Exception, max_depth: int = 10) -> Optional[int]: |
| 28 | current = exc |
| 29 | for _ in range(max_depth): |
| 30 | if isinstance(current, OSError) and current.errno is not None: |
| 31 | return current.errno |
| 32 | nxt = current.__cause__ or current.__context__ |
| 33 | if nxt is None: |
| 34 | break |
| 35 | current = nxt |
| 36 | return None |
| 37 | |
| 38 | |
| 39 | def collect_error_text(exc: Exception, max_depth: int = 10) -> str: |
no outgoing calls
no test coverage detected