errcat

package
v2.9.0-test.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OK           = Category(iota)
	User         // User made an error
	Config       // Errors in config.yml, extensions, or kubeconfig
	NoDaemonLogs // Other error generated in the CLI process, so no use pointing the user to logs
	Unknown      // Something else. Consult the logs
)

Variables

This section is empty.

Functions

func FromResult added in v2.7.2

func FromResult(r *connector.Result) error

func ToResult added in v2.7.2

func ToResult(err error) *connector.Result

Types

type Category

type Category int

The Category is used for categorizing errors so that we can know when to point the user to the logs or not.

func GetCategory

func GetCategory(err error) Category

GetCategory returns the error category for a categorized error, OK for nil, and Unknown for other errors.

func (Category) New

func (c Category) New(untypedErr any) error

New creates a new categorized error based in its argument. The argument can be an error or a string. If it isn't, it will be converted to a string using its '%v' formatter.

func (Category) Newf

func (c Category) Newf(format string, a ...any) error

Newf creates a new categorized error based on a format string with arguments. The error is created using fmt.Errorf() so using '%w' is relevant for error arguments.

Jump to

Keyboard shortcuts

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