gerrors

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(err error) int

ExitCode extracts the exit code from an error. If the error implements ExitCoder, its code is returned. Otherwise returns 1 (generic error).

Types

type ExitCoder

type ExitCoder interface {
	ExitCode() int
}

ExitCoder is implemented by errors that carry a specific exit code.

type TestFailureError

type TestFailureError struct {
	Details string
}

TestFailureError represents a test/assertion failure (exit code 2).

func (*TestFailureError) Error

func (e *TestFailureError) Error() string

func (*TestFailureError) ExitCode

func (e *TestFailureError) ExitCode() int

type ValidationError

type ValidationError struct {
	File    string
	Field   string
	Message string
}

ValidationError represents a user/config error (exit code 1). It records the source file, the missing or invalid field, and a human-readable message.

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) ExitCode

func (e *ValidationError) ExitCode() int

type ValidationErrors

type ValidationErrors struct {
	Errs []*ValidationError
}

ValidationErrors collects multiple validation errors into a single error.

func (*ValidationErrors) Error

func (e *ValidationErrors) Error() string

func (*ValidationErrors) ExitCode

func (e *ValidationErrors) ExitCode() int

func (*ValidationErrors) Unwrap

func (e *ValidationErrors) Unwrap() []error

Unwrap returns the individual errors for errors.As support.

Jump to

Keyboard shortcuts

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