Exception: VectorMCP::ProtocolError
- Defined in:
- lib/vector_mcp/errors.rb
Overview
Base class for all JSON-RPC 2.0 errors that the VectorMCP library can
emit. It mirrors the structure defined by the JSON-RPC spec and adds a
flexible details
field that implementers may use to attach structured,
implementation-specific metadata to an error payload.
Direct Known Subclasses
InternalError, InvalidParamsError, InvalidRequestError, MethodNotFoundError, NotFoundError, ParseError, SamplingError, ServerError
Instance Attribute Summary collapse
-
#code ⇒ Integer
readonly
The JSON-RPC error code.
-
#details ⇒ Hash?
readonly
Additional implementation-specific details for the error (optional).
-
#message ⇒ String
readonly
A short description of the error.
-
#request_id ⇒ String, ...
The ID of the request that caused this error, if applicable.
Instance Method Summary collapse
-
#initialize(message, code: -32_600,, details: nil, request_id: nil) ⇒ ProtocolError
constructor
Initializes a new ProtocolError.
Constructor Details
#initialize(message, code: -32_600,, details: nil, request_id: nil) ⇒ ProtocolError
Initializes a new ProtocolError.
30 31 32 33 34 35 36 37 |
# File 'lib/vector_mcp/errors.rb', line 30 def initialize(, code: -32_600, details: nil, request_id: nil) VectorMCP.logger.debug("Initializing ProtocolError with code: #{code}") @code = code @message = @details = details # NOTE: `data` in JSON-RPC is often used for this purpose. @request_id = request_id super() end |
Instance Attribute Details
#code ⇒ Integer (readonly)
Returns The JSON-RPC error code.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/vector_mcp/errors.rb', line 20 class ProtocolError < Error attr_accessor :request_id attr_reader :code, :message, :details # Initializes a new ProtocolError. # # @param message [String] The error message. # @param code [Integer] The JSON-RPC error code. # @param details [Hash, nil] Additional details for the error (optional). # @param request_id [String, Integer, nil] The ID of the originating request. def initialize(, code: -32_600, details: nil, request_id: nil) VectorMCP.logger.debug("Initializing ProtocolError with code: #{code}") @code = code @message = @details = details # NOTE: `data` in JSON-RPC is often used for this purpose. @request_id = request_id super() end end |
#details ⇒ Hash? (readonly)
Returns Additional implementation-specific details for the error (optional).
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/vector_mcp/errors.rb', line 20 class ProtocolError < Error attr_accessor :request_id attr_reader :code, :message, :details # Initializes a new ProtocolError. # # @param message [String] The error message. # @param code [Integer] The JSON-RPC error code. # @param details [Hash, nil] Additional details for the error (optional). # @param request_id [String, Integer, nil] The ID of the originating request. def initialize(, code: -32_600, details: nil, request_id: nil) VectorMCP.logger.debug("Initializing ProtocolError with code: #{code}") @code = code @message = @details = details # NOTE: `data` in JSON-RPC is often used for this purpose. @request_id = request_id super() end end |
#message ⇒ String (readonly)
Returns A short description of the error.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/vector_mcp/errors.rb', line 20 class ProtocolError < Error attr_accessor :request_id attr_reader :code, :message, :details # Initializes a new ProtocolError. # # @param message [String] The error message. # @param code [Integer] The JSON-RPC error code. # @param details [Hash, nil] Additional details for the error (optional). # @param request_id [String, Integer, nil] The ID of the originating request. def initialize(, code: -32_600, details: nil, request_id: nil) VectorMCP.logger.debug("Initializing ProtocolError with code: #{code}") @code = code @message = @details = details # NOTE: `data` in JSON-RPC is often used for this purpose. @request_id = request_id super() end end |
#request_id ⇒ String, ...
Returns The ID of the request that caused this error, if applicable.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/vector_mcp/errors.rb', line 20 class ProtocolError < Error attr_accessor :request_id attr_reader :code, :message, :details # Initializes a new ProtocolError. # # @param message [String] The error message. # @param code [Integer] The JSON-RPC error code. # @param details [Hash, nil] Additional details for the error (optional). # @param request_id [String, Integer, nil] The ID of the originating request. def initialize(, code: -32_600, details: nil, request_id: nil) VectorMCP.logger.debug("Initializing ProtocolError with code: #{code}") @code = code @message = @details = details # NOTE: `data` in JSON-RPC is often used for this purpose. @request_id = request_id super() end end |