errs

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(err error) int

ExitCode maps an error to a CLI exit code.

Types

type Code

type Code int

Code identifies error categories for exit status mapping.

const (
	CodeGeneric Code = iota + 1
	CodeUsage
	CodeValidation
	CodeNotFound
	CodeConflict
	CodeInternal
)

type Error

type Error struct {
	Code    Code
	Message string
	Hint    string
	// contains filtered or unexported fields
}

Error is a user-facing ForgeKit error with optional internal cause.

func AsForge

func AsForge(err error) (*Error, bool)

AsForge returns a ForgeKit error if present.

func New

func New(code Code, message string) *Error

New creates a user-facing error.

func Wrap

func Wrap(code Code, message string, cause error) *Error

Wrap wraps an internal cause with a user-facing message.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

func (*Error) UserMessage

func (e *Error) UserMessage() string

UserMessage returns a message safe to print to CLI users.

Jump to

Keyboard shortcuts

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