doctor

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Red    = "\033[31m"
	Yellow = "\033[33m"
	Cyan   = "\033[36m"
	White  = "\033[37m"
	Gray   = "\033[90m"
	Reset  = "\033[0m"
	Bold   = "\033[1m"
)

ANSI color codes for terminal output

Variables

View Source
var (
	// ErrPropertyResolution is the canonical errorx property key for attaching
	// human-readable remediation hints to errors. Aliased from pkg/models so that
	// errors set by any package (workflow steps, config loaders, etc.) are found
	// by findResolution regardless of which package attached the property.
	ErrPropertyResolution = models.ErrPropertyResolution
	ErrNamespace          = errorx.NewNamespace("doctor")
	NotFoundError         = ErrNamespace.NewType("not_found", errorx.NotFound())
)
View Source
var VerboseLevel int

VerboseLevel controls error output detail. When >= 1 (-V), CheckErr displays the full stacktrace and profiling data. Otherwise a compact human-friendly error panel is shown and details are written only to the log file.

Functions

func CheckErr

func CheckErr(ctx context.Context, err error, instructions ...string)

CheckErr prints diagnosis and exit with error code 1 Optional instructions can be provided to give additional context to the user

func CheckReportErr

func CheckReportErr(ctx context.Context, report *automa.Report)

CheckReportErr checks an automa.Report for errors and runs diagnosis if any are found

func GetInstructionsFromReport

func GetInstructionsFromReport(report *automa.Report) string

GetInstructionsFromReport recursively searches for instructions in report metadata. Returns the first non-empty instructions found in the report tree, or an empty string if none exist.

Types

type ErrorDiagnosis

type ErrorDiagnosis struct {
	Error              error             `yaml:"error" json:"error"`
	Message            string            `yaml:"message" json:"message"`
	Cause              string            `yaml:"cause" json:"cause"`
	ErrorType          string            `yaml:"errorType" json:"errorType"`
	TraceId            string            `yaml:"traceId" json:"traceId"`
	Commit             string            `yaml:"commit" json:"commit"`
	Version            string            `yaml:"version" json:"version"`
	GoVersion          string            `yaml:"goVersion" json:"goVersion"`
	Pid                int               `yaml:"pid" json:"pid"`
	StackTrace         []string          `yaml:"stackTrace" json:"stackTrace"`
	Code               int               `yaml:"code" json:"code"`
	Logfile            string            `yaml:"log" json:"log"`
	ProfilingSnapshots map[string]string `yaml:"ProfilingSnapshots" json:"profilingSnapshots"`
	Resolution         []string          `yaml:"steps" json:"steps"`
	WhyFloor           string            `yaml:"whyFloor" json:"whyFloor"`
}

func Diagnose

func Diagnose(ctx context.Context, ex error) *ErrorDiagnosis

Diagnose attempts to find a resolution and provide a human friendly error response In the future, it may connect to a remote API to provide a better and AI driven response

Jump to

Keyboard shortcuts

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