internal

package
v1.0.2-beta Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrorf

func NewErrorf(code ErrorCode, format string, a ...interface{}) error

NewErrorf instantiates a new error.

func WrapErrorf

func WrapErrorf(orig error, code ErrorCode, format string, a ...interface{}) error

WrapErrorf returns a wrapped error.

Types

type Error

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

Error represents an error that could be wrapping another error, it includes a code for determining what triggered the error.

func (*Error) Code

func (e *Error) Code() ErrorCode

Code returns the code representing this error.

func (*Error) Error

func (e *Error) Error() string

Error returns the message, when wrapping errors the wrapped error is returned.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the wrapped error, if any.

type ErrorCode

type ErrorCode uint

ErrorCode defines supported error codes.

const (
	// ErrorCodeUnknown represents an unknown error
	ErrorCodeUnknown ErrorCode = iota + 1
	// ErrorCodeInvalidArgument represents an invalid argument error
	ErrorCodeInvalidArgument
	// ErrorMissingArgument represents an missing argument error
	ErrorMissingArgument
)

Error codes is also used as exit code Must always start at 1

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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