Exception: VectorMCP::ServerError

Inherits:
ProtocolError show all
Defined in:
lib/vector_mcp/errors.rb

Overview

Represents a JSON-RPC server-defined error (codes -32000 to -32099).

Direct Known Subclasses

InitializationError

Instance Attribute Summary

Attributes inherited from ProtocolError

#code, #details, #message, #request_id

Instance Method Summary collapse

Constructor Details

#initialize(message = "Server error", code: -32_000,, details: nil, request_id: nil) ⇒ ServerError

Returns a new instance of ServerError.

Parameters:

  • message (String) (defaults to: "Server error")

    The error message.

  • code (Integer) (defaults to: -32_000,)

    The server-defined error code. Must be between -32099 and -32000. If the supplied value falls outside this range it will be coerced to -32000 in order to comply with the JSON-RPC 2.0 specification.

  • details (Hash, nil) (defaults to: nil)

    Additional details for the error (optional).

  • request_id (String, Integer, nil) (defaults to: nil)

    The ID of the originating request.



106
107
108
109
110
111
112
113
# File 'lib/vector_mcp/errors.rb', line 106

def initialize(message = "Server error", code: -32_000, details: nil, request_id: nil)
  VectorMCP.logger.debug("Initializing ServerError with code: #{code}")
  unless (-32_099..-32_000).cover?(code)
    warn "Server error code #{code} is outside of the reserved range (-32099 to -32000). Using -32000 instead."
    code = -32_000
  end
  super
end