Class: A2A::TaskNotFoundError

Inherits:
JSONRPC::Error
  • Object
show all
Defined in:
lib/a2a/types/task_not_found_error.rb

Overview

Error for missing tasks (-32001)

Raised when the specified task ID does not correspond to an existing or active task. It might be invalid, expired, or already completed and purged.

Examples:

Create a task not found error

error = JSONRPC::TaskNotFoundError.new

Instance Method Summary collapse

Constructor Details

#initialize(message = 'Task not found.', data: nil, request_id: nil) ⇒ TaskNotFoundError

Creates a new Task Not Found Error with code -32001

Examples:

Create a task not found error with default message

error = JSONRPC::TaskNotFoundError.new

Create a task not found error with exception details

error = JSONRPC::TaskNotFoundError.new(data: { task_id: 'invalid-id' }, request_id: 1)

Parameters:

  • message (String) (defaults to: 'Task not found.')

    short description of the error

  • data (Hash, Array, String, Number, Boolean, nil) (defaults to: nil)

    additional error information

  • request_id (String, Integer, nil) (defaults to: nil)

    the request identifier



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/a2a/types/task_not_found_error.rb', line 29

def initialize(
  message = 'Task not found.',
  data: nil,
  request_id: nil
)
  super(
    message,
    code: ErrorCodes::TASK_NOT_FOUND,
    data:,
    request_id:
  )
end