errs

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package errs classifies errors into categories that determine exit codes and user-facing hints. Each Category maps to a distinct exit code so that callers can distinguish internal bugs from user mistakes, environment failures, and content problems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advised

type Advised interface {
	NextAction() string
}

Advised is implemented by errors that can suggest a remediation step.

type Categorized

type Categorized interface {
	Category() Category
}

Categorized is implemented by errors that know their own Category.

type Category

type Category int

Category classifies an error into one of four buckets that drive the process exit code and user-facing messaging.

const (
	// CategoryInternal indicates an unexpected bug inside diffah itself.
	CategoryInternal Category = iota
	// CategoryUser indicates the caller provided invalid arguments or flags.
	CategoryUser
	// CategoryEnvironment indicates an external factor (network, filesystem,
	// auth) prevented the operation from succeeding.
	CategoryEnvironment
	// CategoryContent indicates the input data (image, bundle, sidecar) is
	// malformed or incompatible.
	CategoryContent
)

func Classify

func Classify(err error) (Category, string)

func (Category) ExitCode

func (c Category) ExitCode() int

ExitCode returns the process exit code associated with the category.

func (Category) String

func (c Category) String() string

String returns a human-readable label for the category.

Jump to

Keyboard shortcuts

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