errors

package
v0.0.0-...-5b4c5eb Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Internal        failure.StringCode = "Internal"
	InvalidArgument failure.StringCode = "InvalidArgument"
	NotFound        failure.StringCode = "NotFound"
	Unauthenticated failure.StringCode = "Unauthenticated"
)

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

func NewUserIDContext

func NewUserIDContext(userID uint) failure.Context

func WithTableContext

func WithTableContext(c failure.Context, table string) failure.Context

func WithUserIDContext

func WithUserIDContext(c failure.Context, userID uint) failure.Context

Types

type AnnotatedError

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

func NewAnnotatedError

func NewAnnotatedError(code Code, options ...Option) *AnnotatedError

func NewFailedPreconditionError

func NewFailedPreconditionError(options ...Option) *AnnotatedError

func NewInternalError

func NewInternalError(options ...Option) *AnnotatedError

func NewInvalidArgumentError

func NewInvalidArgumentError(options ...Option) *AnnotatedError

func NewNotFoundError

func NewNotFoundError(options ...Option) *AnnotatedError

func (*AnnotatedError) Code

func (e *AnnotatedError) Code() Code

func (*AnnotatedError) Error

func (e *AnnotatedError) Error() string

func (*AnnotatedError) IsInternal

func (e *AnnotatedError) IsInternal() bool

func (*AnnotatedError) IsInvalidArgument

func (e *AnnotatedError) IsInvalidArgument() bool

func (*AnnotatedError) IsNotFound

func (e *AnnotatedError) IsNotFound() bool

func (*AnnotatedError) OutputStackTrace

func (e *AnnotatedError) OutputStackTrace() bool

func (*AnnotatedError) Resources

func (e *AnnotatedError) Resources() []*Resource

func (*AnnotatedError) StackTrace

func (e *AnnotatedError) StackTrace() errors.StackTrace

type Code

type Code int
const (
	CodeNotFound           Code = 1
	CodeInvalidArgument    Code = 2
	CodeInternal           Code = 3
	CodeFailedPrecondition Code = 4
)

func (Code) String

func (c Code) String() string

type Option

type Option func(*AnnotatedError)

func WithError

func WithError(err error) Option

func WithMessage

func WithMessage(message string) Option

func WithMessagef

func WithMessagef(format string, args ...interface{}) Option

func WithOutputStackTrace

func WithOutputStackTrace(outputStackTrace bool) Option

func WithResource

func WithResource(r *Resource) Option

type Resource

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

func NewResource

func NewResource(kind, key string, value interface{}) *Resource

func NewResourceWithEntries

func NewResourceWithEntries(kind string, entries []ResourceEntry) *Resource

func (*Resource) String

func (r *Resource) String() string

type ResourceEntry

type ResourceEntry struct {
	Key   string
	Value interface{}
}

type StackTracer

type StackTracer interface {
	StackTrace() errors.StackTrace
}

Jump to

Keyboard shortcuts

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