errfmt

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatStderr

func FormatStderr(err error) string

FormatStderr returns a formatted error string for stderr output.

Types

type Category

type Category string

Category represents the type of error.

const (
	CategoryAuth        Category = "auth"
	CategoryPermission  Category = "permission"
	CategoryNotFound    Category = "not_found"
	CategoryTimeout     Category = "timeout"
	CategoryMissingAuth Category = "missing_auth"
	CategoryConflict    Category = "conflict"
	CategoryGeneric     Category = "generic"
)

type ClassifiedError

type ClassifiedError struct {
	Original error
	Category Category
	Hint     string
}

ClassifiedError holds a classified error with an actionable hint.

func Classify

func Classify(err error) *ClassifiedError

Classify auto-detects the error category and adds an actionable hint.

func (*ClassifiedError) Error

func (c *ClassifiedError) Error() string

func (*ClassifiedError) Unwrap

func (c *ClassifiedError) Unwrap() error

Jump to

Keyboard shortcuts

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