MCPcopy Index your code
hub / github.com/commandoperator/cmdop-sdk / map_core_error

Function map_core_error

python/src/cmdop/errors.py:128–138  ·  view source on GitHub ↗

Map a core ``ErrorInfo{code, message}`` to a typed exception.

(code: str, message: str)

Source from the content-addressed store, hash-verified

126
127
128def map_core_error(code: str, message: str) -> CmdopError:
129 """Map a core ``ErrorInfo{code, message}`` to a typed exception."""
130 if code == "rate_limit":
131 return RateLimitError(message, code=code)
132
133 cls = _CODE_MAP.get(code)
134 if cls is not None:
135 return cls(message, code=code)
136
137 # internal / unknown_op / unsupported / anything new -> base error.
138 return CmdopError(message, code=code)

Callers 2

_to_errorMethod · 0.90
_stream_errorFunction · 0.90

Calls 3

RateLimitErrorClass · 0.70
CmdopErrorClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected