Exception: A2A::ContentTypeNotSupportedError

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

Overview

A Media Type provided in the request’s message parts or implied for an artifact is not supported by the agent or the specific skill being invoked.

Instance Attribute Summary

Attributes inherited from Error

#code, #http_status

Instance Method Summary collapse

Methods inherited from Error

#to_h

Constructor Details

#initialize(content_type = nil, message: "Content type not supported") ⇒ ContentTypeNotSupportedError

Returns a new instance of ContentTypeNotSupportedError.



127
128
129
130
# File 'lib/a2a/errors.rb', line 127

def initialize(content_type = nil, message: "Content type not supported")
  @content_type = content_type
  super(message, code: -32005, http_status: 400)
end

Instance Method Details

#error_dataObject



132
133
134
135
136
137
138
139
140
141
# File 'lib/a2a/errors.rb', line 132

def error_data
  meta = {}
  meta["contentType"] = @content_type.to_s if @content_type
  [{
    "@type"    => "type.googleapis.com/google.rpc.ErrorInfo",
    "reason"   => "CONTENT_TYPE_NOT_SUPPORTED",
    "domain"   => "a2a-protocol.org",
    "metadata" => meta,
  }]
end