xerrors

package
v0.0.0-...-2c63f42 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoError            = Code(0)
	Canceled           = Code(1)
	Unknown            = Code(2)
	InvalidArgument    = Code(3)
	DeadlineExceeded   = Code(4)
	NotFound           = Code(5)
	AlreadyExists      = Code(6)
	PermissionDenied   = Code(7)
	ResourceExhausted  = Code(8)
	FailedPrecondition = Code(9)
	Aborted            = Code(10)
	OutOfRange         = Code(11)
	Unimplemented      = Code(12)
	Internal           = Code(13)
	Unavailable        = Code(14)
	DataLoss           = Code(15)
	Unauthenticated    = Code(16)

	RuntimePanic = Code(100)
	BadRoute     = Code(101)
	Malformed    = Code(102)
)

Error constants from twirp

Variables

This section is empty.

Functions

func DefaultErrorMessage

func DefaultErrorMessage(code Code) string

func IsValidStandardErrorCode

func IsValidStandardErrorCode(c Code) bool

Types

type APIError

type APIError struct {
	Code     Code
	Err      error
	Message  string
	Original string
	OrigFile string
	OrigLine int
	Stack    errors.StackTrace
	Trace    bool
	Trivial  bool
	Meta     map[string]string
}

func Errorf

func Errorf(code Code, err error, message string, args ...interface{}) *APIError

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) WithMeta

func (e *APIError) WithMeta(key string, value string) *APIError

type Code

type Code int

func GetCode

func GetCode(err error) Code

func (Code) String

func (c Code) String() string

type IError

type IError interface {
	error
	IStack

	Format(st fmt.State, verb rune)
}

IError defines error interface returned by xerrors package

type IStack

type IStack interface {
	StackTrace() errors.StackTrace
}

IStack declares that the error has stacktrace. It's compatible with github.com/pkg/errors package.

Jump to

Keyboard shortcuts

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