Exception: McpOnRuby::Error
- Inherits:
-
StandardError
- Object
- StandardError
- McpOnRuby::Error
- Defined in:
- lib/mcp_on_ruby/errors.rb
Overview
Base error class for MCP-related errors
Direct Known Subclasses
AuthorizationError, ConfigurationError, InvalidParamsError, InvalidRequestError, MethodNotFoundError, NotFoundError, ParseError, RateLimitError, ResourceReadError, ToolExecutionError, TransportError, ValidationError
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(message, code: nil, data: nil) ⇒ Error
constructor
A new instance of Error.
-
#to_json_rpc ⇒ Object
Convert error to JSON-RPC error format.
Constructor Details
#initialize(message, code: nil, data: nil) ⇒ Error
Returns a new instance of Error.
8 9 10 11 12 |
# File 'lib/mcp_on_ruby/errors.rb', line 8 def initialize(, code: nil, data: nil) super() @code = code @data = data end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'lib/mcp_on_ruby/errors.rb', line 6 def code @code end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/mcp_on_ruby/errors.rb', line 6 def data @data end |
Instance Method Details
#to_json_rpc ⇒ Object
Convert error to JSON-RPC error format
15 16 17 18 19 20 21 |
# File 'lib/mcp_on_ruby/errors.rb', line 15 def to_json_rpc { code: @code || default_error_code, message: , data: @data }.compact end |