providererror

package
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package providererror defines provider-agnostic provider failure metadata carried through ACP and ADK runtime layers.

Index

Constants

View Source
const (
	// WireKey is the ACP metadata/data key for provider errors.
	WireKey = "provider_error"
	// ADKMetadataKey is the ADK event metadata key used after ACP mapping.
	ADKMetadataKey = "acp_provider_error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind string
const (
	KindQuotaExceeded          Kind = "quota_exceeded"
	KindAuthenticationRequired Kind = "authentication_required"
	KindPaymentRequired        Kind = "payment_required"
	KindRateLimited            Kind = "rate_limited"
	KindUnavailable            Kind = "unavailable"
	KindInvalidRequest         Kind = "invalid_request"
	KindUnknown                Kind = "unknown"
)

type ProviderError

type ProviderError struct {
	Kind      Kind   `json:"kind"`
	Message   string `json:"message,omitempty"`
	RequestID string `json:"request_id,omitempty"`
	Provider  string `json:"provider,omitempty"`
	Retryable *bool  `json:"retryable,omitempty"`
}

ProviderError is a provider-agnostic classification of a provider-side failure. It intentionally mirrors the ACP wire shape without branding.

func FromADKMetadata

func FromADKMetadata(meta map[string]any) (*ProviderError, bool)

FromADKMetadata extracts a provider error already mapped to ADK metadata.

func FromMetadata

func FromMetadata(meta map[string]any) (*ProviderError, bool)

FromMetadata extracts provider_error from ACP metadata.

func FromWireData

func FromWireData(data any) (*ProviderError, bool)

FromWireData extracts provider_error from JSON-RPC error data or ACP _meta.

func FromWireValue

func FromWireValue(value any) (*ProviderError, bool)

FromWireValue parses the provider_error object itself.

func (*ProviderError) Error

func (e *ProviderError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL