errors

package module
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 2 Imported by: 0

README

Station Manager: errors package

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = stderr.New("Not found")

ErrNotFound is a non-domain-specific sentinel error for when a value is not found.

Functions

func PrintChain added in v0.0.10

func PrintChain(err error)

func Root added in v0.0.7

func Root(err error) error

Root returns the root cause error in an error chain.

It repeatedly unwraps the provided error using errors.Unwrap until there is no further wrapped error. If err is nil, Root returns nil. If the error chain contains a cycle (which should be rare), Root will stop at the last unique error before the cycle to avoid an infinite loop.

Types

type DetailedError

type DetailedError struct {
	// contains filtered or unexported fields
}

func AsDetailedError

func AsDetailedError(err error) (*DetailedError, bool)

AsDetailedError attempts to cast the given error to a DetailedError instance.

func New

func New(op Op) *DetailedError

New creates a new error with the given Op and a default message: "Internal system error." The Cause is set to nil.

func (*DetailedError) Cause

func (e *DetailedError) Cause() error

Cause returns the cause of a DetailedError instance.

func (*DetailedError) Err

func (e *DetailedError) Err(err error) *DetailedError

Err sets the cause for a DetailedError instance.

func (*DetailedError) Error

func (e *DetailedError) Error() string

Error implements the error interface.

func (*DetailedError) Errorf

func (e *DetailedError) Errorf(format string, a ...any) *DetailedError

Errorf formats the error message for a DetailedError instance.

Syntactically the same as fmt.Errorf.

func (*DetailedError) Msg

func (e *DetailedError) Msg(msg string) *DetailedError

Msg sets the human-readable error message for a DetailedError instance.

func (*DetailedError) Msgf added in v0.0.5

func (e *DetailedError) Msgf(format string, a ...any) *DetailedError

func (*DetailedError) Op added in v0.0.4

func (e *DetailedError) Op() Op

Op returns the operation identifier associated with this error.

func (*DetailedError) Unwrap added in v0.0.3

func (e *DetailedError) Unwrap() error

Unwrap provides compatibility with the errors.Unwrap function.

type Error

type Error interface {
	error
}

type Op

type Op string

Jump to

Keyboard shortcuts

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