Exception: A2A::TaskNotCancelableError
- Defined in:
- lib/a2a/errors.rb
Overview
An attempt was made to cancel a task that is not in a cancelable state (e.g., it has already reached a terminal state like completed, failed, or canceled).
Instance Attribute Summary
Attributes inherited from Error
Instance Method Summary collapse
- #error_data ⇒ Object
-
#initialize(task_id, state:, message: "Task is not cancelable") ⇒ TaskNotCancelableError
constructor
A new instance of TaskNotCancelableError.
Methods inherited from Error
Constructor Details
#initialize(task_id, state:, message: "Task is not cancelable") ⇒ TaskNotCancelableError
Returns a new instance of TaskNotCancelableError.
76 77 78 79 80 |
# File 'lib/a2a/errors.rb', line 76 def initialize(task_id, state:, message: "Task is not cancelable") @task_id = task_id @state = state super(, code: -32002, http_status: 400) end |
Instance Method Details
#error_data ⇒ Object
82 83 84 85 86 87 88 89 |
# File 'lib/a2a/errors.rb', line 82 def error_data [{ "@type" => "type.googleapis.com/google.rpc.ErrorInfo", "reason" => "TASK_NOT_CANCELABLE", "domain" => "a2a-protocol.org", "metadata" => { "taskId" => @task_id.to_s, "state" => @state.to_s }, }] end |