Exception: SmilyCli::McpError
- Defined in:
- lib/smily_cli/errors.rb
Overview
Raised when an MCP interaction fails: a JSON-RPC error envelope, a tool that
returns isError: true, a missing session, or a transport failure.
Instance Attribute Summary collapse
-
#code ⇒ Integer?
readonly
JSON-RPC error code, when present.
Instance Method Summary collapse
- #exit_status ⇒ Object
-
#initialize(message, code: nil) ⇒ McpError
constructor
A new instance of McpError.
Constructor Details
#initialize(message, code: nil) ⇒ McpError
Returns a new instance of McpError.
36 37 38 39 |
# File 'lib/smily_cli/errors.rb', line 36 def initialize(, code: nil) super() @code = code end |
Instance Attribute Details
#code ⇒ Integer? (readonly)
Returns JSON-RPC error code, when present.
32 33 34 |
# File 'lib/smily_cli/errors.rb', line 32 def code @code end |
Instance Method Details
#exit_status ⇒ Object
41 42 43 44 |
# File 'lib/smily_cli/errors.rb', line 41 def exit_status # -32000 "Unauthorized", -32001 "Session not found" map to auth failures. [-32_000, -32_001].include?(code) ? 3 : 1 end |