errors

package
v0.1.0-alpha.0...-2488347 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InvalidArgumentErr

func InvalidArgumentErr(format string, a ...interface{}) error

InvalidArgumentErr creates a gRPC InvalidArgument error with the given description.

func NotFoundErr

func NotFoundErr(format string, a ...interface{}) error

NotFoundErr creates a gRPC NotFound error with the given description.

Types

type ConfigsNotFound

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

ConfigsNotFound is an error used when the search for a config file results in that file not being found.

func NewConfigsNotFoundError

func NewConfigsNotFoundError(searchPaths []string) *ConfigsNotFound

NewConfigsNotFoundError returns a new instance of a ConfigsNotFound error.

func (*ConfigsNotFound) Error

func (e *ConfigsNotFound) Error() string

Error returns the error string and fulfils the error interface.

type MultiError

type MultiError struct {
	// Errors is a the collection of errors that the MultiError keeps track of.
	Errors []error

	// For is a string that describes the process/function that the MultiError
	// is used for. This is optional.
	For string

	// Context is a general purpose mapping that can be used to store context
	// information about errors, such as their source. This is useful when passing
	// the MultiError across different scopes where not all info may be present.
	Context map[string]string
}

MultiError is a collection of errors that also fulfills the error interface.

It can be used to aggregate errors and then return them all at once.

func NewMultiError

func NewMultiError(source string) *MultiError

NewMultiError creates a new instance of a MultiError.

func (*MultiError) Add

func (err *MultiError) Add(e error)

Add adds an error to the MultiError.

func (*MultiError) Err

func (err *MultiError) Err() error

Err returns the MultiError if any errors exist. Otherwise, it returns nil.

func (MultiError) Error

func (err MultiError) Error() string

Error returns the error string

func (*MultiError) HasErrors

func (err *MultiError) HasErrors() bool

HasErrors checks to see if the MultiError is tracking any errors.

type UnsupportedCommandError

type UnsupportedCommandError struct{}

UnsupportedCommandError is an error that can be used to designate that a given device does not support an operation, e.g. write. Write is required by the PluginHandler interface, but if a device (e.g. a temperature sensor) doesn't support writing, this error can be returned.

func (*UnsupportedCommandError) Error

func (e *UnsupportedCommandError) Error() string

Jump to

Keyboard shortcuts

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