errcat

package
v2.4.3-rc.4 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 2 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
	NoLogs  // 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

This section is empty.

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 interface{}) 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 ...interface{}) 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