MCPcopy Create free account
hub / github.com/cdgriffith/Box / _exception_cause

Function _exception_cause

box/box.py:65–72  ·  view source on GitHub ↗

Unwrap BoxKeyError and BoxValueError errors to their cause. Use with `raise ... from _exception_cause(err)` to avoid deeply nested stacktraces, but keep the context.

(e)

Source from the content-addressed store, hash-verified

63
64
65def _exception_cause(e):
66 """
67 Unwrap BoxKeyError and BoxValueError errors to their cause.
68
69 Use with `raise ... from _exception_cause(err)` to avoid deeply nested stacktraces, but keep the
70 context.
71 """
72 return e.__cause__ if isinstance(e, (BoxKeyError, BoxValueError)) else e
73
74
75def _camel_killer(attr):

Callers 5

__recastMethod · 0.85
__getitem__Method · 0.85
__getattr__Method · 0.85
__delitem__Method · 0.85
__delattr__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected