Module: Insika::Server::A2A::Errors

Defined in:
lib/insika/server/a2a/errors.rb

Overview

A2A adapter error map: standard JSON-RPC 2.0 codes + A2A extensions. The App NEVER leaks an exception — always an error object.

Constant Summary collapse

PARSE_ERROR =
-32_700
INVALID_REQUEST =
-32_600
METHOD_NOT_FOUND =
-32_601
INVALID_PARAMS =
-32_602
INTERNAL_ERROR =
-32_603
TASK_NOT_FOUND =

A2A TaskNotFoundError

-32_001 # A2A TaskNotFoundError
TASK_NOT_CANCELABLE =

A2A TaskNotCancelableError

-32_002 # A2A TaskNotCancelableError

Class Method Summary collapse

Class Method Details

.from_exception(error) ⇒ Object

Core exception -> [code, message]. A task NotFoundError is handled EXPLICITLY in the App (tasks/get returns TASK_NOT_FOUND directly), so here NotFoundError falls into INVALID_PARAMS (missing agent/session in the request). Anything else -> INTERNAL_ERROR (generic message, no stack).



21
22
23
24
25
26
27
28
# File 'lib/insika/server/a2a/errors.rb', line 21

def self.from_exception(error)
  case error
  when Insika::ValidationError, Insika::NotFoundError
    [INVALID_PARAMS, error.message]
  else
    [INTERNAL_ERROR, "internal error"]
  end
end