Exception: A2A::TaskNotFoundError

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

Overview

The specified task ID does not correspond to an existing or accessible task. It might be invalid, expired, or already completed and purged.

Instance Attribute Summary

Attributes inherited from Error

#code, #http_status

Instance Method Summary collapse

Methods inherited from Error

#to_h

Constructor Details

#initialize(task_id, message: "Task not found") ⇒ TaskNotFoundError

Returns a new instance of TaskNotFoundError.



58
59
60
61
# File 'lib/a2a/errors.rb', line 58

def initialize(task_id, message: "Task not found")
  @task_id = task_id
  super(message, code: -32001, http_status: 404)
end

Instance Method Details

#error_dataObject



63
64
65
66
67
68
69
70
# File 'lib/a2a/errors.rb', line 63

def error_data
  [{
    "@type"    => "type.googleapis.com/google.rpc.ErrorInfo",
    "reason"   => "TASK_NOT_FOUND",
    "domain"   => "a2a-protocol.org",
    "metadata" => { "taskId" => @task_id.to_s },
  }]
end