errors

package
v0.0.0-...-8ad6148 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Separator = "::"

Functions

func E

func E(args ...interface{}) error

E builds an error value from its arguments.

func Errorf

func Errorf(format string, args ...interface{}) error

Errorf is equivalent to fmt.Errorf, but allows clients to import only this package for all error handling.

func Is

func Is(err error, kind Kind) bool

func Str

func Str(text string) error

Types

type Error

type Error struct {
	Op   Op
	Kind Kind
	Err  error
}

Error is the type that implements the error interface.

func (*Error) Error

func (e *Error) Error() string

type Kind

type Kind uint8

Kind kind of error.

const (
	Other            Kind = iota // Unclassified error.
	Invalid                      // Invalid operation for this type of item.
	IO                           // External I/O error such as network failure.
	Internal                     // Internal error or inconsistency.
	EvalTimeout                  // Evaluation timed out.
	LanguageNotFound             // Language not found.
)

Kinds of errors.

func (Kind) HTTPStatus

func (k Kind) HTTPStatus() int

HTTPStatus transforms error kind to HTTP status code

func (Kind) String

func (k Kind) String() string

type Op

type Op string

Op operation

Jump to

Keyboard shortcuts

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