Class: RubyLLM::MCP::Error
- Inherits:
-
Object
- Object
- RubyLLM::MCP::Error
- Defined in:
- lib/ruby_llm/mcp/error.rb
Instance Method Summary collapse
-
#initialize(error_data) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(error_data) ⇒ Error
Returns a new instance of Error.
6 7 8 9 10 |
# File 'lib/ruby_llm/mcp/error.rb', line 6 def initialize(error_data) @code = error_data["code"] @message = error_data["message"] @data = error_data["data"] end |
Instance Method Details
#to_s ⇒ Object
29 30 31 |
# File 'lib/ruby_llm/mcp/error.rb', line 29 def to_s "Error: code: #{@code} (#{type}), message: #{@message}, data: #{@data}" end |
#type ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ruby_llm/mcp/error.rb', line 12 def type case @code when -32_700 :parse_error when -32_600 :invalid_request when -32_601 :method_not_found when -32_602 :invalid_params when -32_603 :internal_error else :custom_error end end |