Documentation
¶
Overview ¶
Package diag provides lightweight error classification for runtime metrics and status panels. It deliberately avoids defining a custom Error type: callers wrap errors with fmt.Errorf("...: %w", diag.ErrXxx) and use errors.Is to detect categories.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrConfig = errors.New("config error") ErrPermission = errors.New("permission denied") ErrProvider = errors.New("provider error") ErrSession = errors.New("session error") ErrToolInput = errors.New("tool input error") ErrToolExec = errors.New("tool execution error") )
Sentinel errors that callers wrap with fmt.Errorf("...: %w", diag.ErrXxx) to declare a category. Categorize() walks the chain and matches via errors.Is.
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category string
Category classifies errors for metrics and human-readable status output. Use Categorize(err) to derive a Category from any error chain.
const ( CatUnknown Category = "unknown" CatCanceled Category = "canceled" CatConfig Category = "config" CatPermission Category = "permission" CatProvider Category = "provider" CatSession Category = "session" CatToolInput Category = "tool_input" CatToolExec Category = "tool_exec" CatLLM Category = "llm" CatAgent Category = "agent" )
func Categorize ¶
Categorize walks err's chain and returns the matching Category. More specific cases are checked first; unrecognized errors return CatUnknown.