diag

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

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

View Source
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

func Categorize(err error) Category

Categorize walks err's chain and returns the matching Category. More specific cases are checked first; unrecognized errors return CatUnknown.

Jump to

Keyboard shortcuts

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