apierror

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: None detected not legal advice Imports: 0 Imported by: 0

Documentation

Overview

Package apierror 提供 API 错误类型定义,供 api 和 retry 包共享.

这避免了 api 包和 retry 包之间的循环依赖.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorCategory

type ErrorCategory int

ErrorCategory 是 API 错误的语义分类枚举.

const (
	ErrUnknown ErrorCategory = iota
	ErrAborted
	ErrTimeout
	ErrRateLimit
	ErrOverloaded
	ErrPromptTooLong
	ErrMediaTooLarge
	ErrRequestTooLarge
	ErrInvalidRequest
	ErrAuthentication
	ErrModelNotFound
	ErrBilling
	ErrServerError
	ErrConnection
	ErrSSL
	ErrToolMismatch
	ErrUnexpectedTool
	ErrDuplicateToolID
	ErrInvalidModel
	ErrContentPolicy
)

func (ErrorCategory) IsRetryableByDefault

func (c ErrorCategory) IsRetryableByDefault() bool

IsRetryableByDefault 返回该分类是否默认可重试.

func (ErrorCategory) String

func (c ErrorCategory) String() string

String 返回分类的分析用字符串(Datadog tag 等).

type RetryInfo

type RetryInfo struct {
	Retryable  bool
	After      time.Duration
	MaxRetries int
	ServerSaid *bool
}

RetryInfo 封装重试建议,由 ErrorClassifier 在分类时一次性填充.

Jump to

Keyboard shortcuts

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