Exception: A2A::InvalidParamsError

Inherits:
Error
  • Object
show all
Defined in:
lib/a2a/errors.rb

Overview

Validation error for invalid input parameters or message format. Maps to JSON-RPC standard code -32602 (Invalid params).

Instance Attribute Summary

Attributes inherited from Error

#code, #http_status

Instance Method Summary collapse

Methods inherited from Error

#to_h

Constructor Details

#initialize(message, fields: nil) ⇒ InvalidParamsError

Returns a new instance of InvalidParamsError.



219
220
221
222
# File 'lib/a2a/errors.rb', line 219

def initialize(message, fields: nil)
  @fields = fields
  super(message, code: -32602, http_status: 400)
end

Instance Method Details

#error_dataObject



224
225
226
227
228
229
230
231
232
# File 'lib/a2a/errors.rb', line 224

def error_data
  return nil unless @fields
  [{
    "@type"    => "type.googleapis.com/google.rpc.ErrorInfo",
    "reason"   => "INVALID_PARAMS",
    "domain"   => "a2a-protocol.org",
    "metadata" => { "fields" => Array(@fields).join(", ") },
  }]
end