Exception: Mpp::Extensions::MCP::MalformedCredentialError

Inherits:
StandardError
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/mpp/extensions/mcp/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(detail:, message: "Invalid params") ⇒ MalformedCredentialError

Returns a new instance of MalformedCredentialError.



90
91
92
93
94
# File 'lib/mpp/extensions/mcp/errors.rb', line 90

def initialize(detail:, message: "Invalid params")
  @detail = T.let(detail, T.untyped)
  @code = T.let(CODE_MALFORMED_CREDENTIAL, Integer)
  super(message)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



87
88
89
# File 'lib/mpp/extensions/mcp/errors.rb', line 87

def code
  @code
end

#detailObject (readonly)

Returns the value of attribute detail.



84
85
86
# File 'lib/mpp/extensions/mcp/errors.rb', line 84

def detail
  @detail
end

Instance Method Details

#to_jsonrpc_errorObject



97
98
99
100
101
102
103
104
105
106
# File 'lib/mpp/extensions/mcp/errors.rb', line 97

def to_jsonrpc_error
  {
    "code" => CODE_MALFORMED_CREDENTIAL,
    "message" => message,
    "data" => {
      "httpStatus" => HTTP_STATUS_PAYMENT_REQUIRED,
      "detail" => @detail
    }
  }
end