MCPcopy
hub / github.com/pallets/click / augment_usage_errors

Function augment_usage_errors

src/click/core.py:120–135  ·  view source on GitHub ↗

Context manager that attaches extra information to exceptions.

(
    ctx: Context, param: Parameter | None = None
)

Source from the content-addressed store, hash-verified

118
119@contextmanager
120def augment_usage_errors(
121 ctx: Context, param: Parameter | None = None
122) -> cabc.Generator[None]:
123 """Context manager that attaches extra information to exceptions."""
124 try:
125 yield
126 except BadParameter as e:
127 if e.ctx is None:
128 e.ctx = ctx
129 if param is not None and e.param is None:
130 e.param = param
131 raise
132 except UsageError as e:
133 if e.ctx is None:
134 e.ctx = ctx
135 raise
136
137
138def iter_params_for_processing(

Callers 2

invokeMethod · 0.85
handle_parse_resultMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected