actionableerror

package
v0.53.6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package actionableerror owns the stable CLI/MCP recovery guidance envelope.

Index

Constants

View Source
const SchemaVersionV1 = "stackkit.actionable-error/v1"

Variables

This section is empty.

Functions

func WithDiagnostic added in v0.53.1

func WithDiagnostic(reason string, cause error) error

WithDiagnostic attaches a known condition at its construction boundary. The original error remains available for evidence and errors.Is/As; public text contains only the authority-owned cause.

Types

type Contract

type Contract struct {
	SchemaVersion string   `json:"schemaVersion"`
	Code          string   `json:"code"`
	ReasonCode    string   `json:"reasonCode"`
	Message       string   `json:"message"`
	UserGuidance  []string `json:"userGuidance"`
	Retryable     bool     `json:"retryable"`
	// RetryAfter is the RFC 3339 UTC time an external authority named for the
	// next attempt; it is omitted when no authority named one.
	RetryAfter string `json:"retryAfter,omitempty"`
}

func Diagnostic added in v0.53.1

func Diagnostic(reason string) (Contract, bool)

Diagnostic is a closed lookup, never a classification of arbitrary reason text. RetryAfter remains supplied by the observed external authority.

func Diagnostics added in v0.53.1

func Diagnostics() []Contract

Diagnostics is the deterministic projection used by the self-check plan and troubleshooting generator. A catalog entry is guidance, not measured health.

func FromError added in v0.53.1

func FromError(err error) (Contract, bool)

FromError preserves typed recovery and denial contracts, including external RetryAfter. Callers still own redaction and the transport's outcome status.

func New

func New(code, reason, message string, guidance []string, retryable bool) Contract

func (Contract) Validate

func (c Contract) Validate() error

type RecordedFailure added in v0.53.1

type RecordedFailure struct {
	Failure string   `json:"failure"`
	Reasons []string `json:"reasonCodes"`
}

func RecordedFailures added in v0.53.1

func RecordedFailures() []RecordedFailure

RecordedFailures indexes the historical terminal conditions to the same contracts; consumers never maintain a separate copy of this mapping.

Jump to

Keyboard shortcuts

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