MCPcopy
hub / github.com/Runnin4ik/dpi-detector / get_errno_from_chain

Function get_errno_from_chain

utils/error_classifier.py:27–36  ·  view source on GitHub ↗
(exc: Exception, max_depth: int = 10)

Source from the content-addressed store, hash-verified

25
26
27def 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
39def collect_error_text(exc: Exception, max_depth: int = 10) -> str:

Callers 2

classify_connect_errorFunction · 0.85
classify_read_errorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected