errors

package
v0.16.25 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: BSD-3-Clause Imports: 5 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GenAccessErr           = genWithErrorAndItem(Access)
	GenAlreadyExistsErr    = genWithErrorAndItem(AlreadyExists)
	GenBusyErr             = genWithErrorAndItem(Busy)
	GenExpiredErr          = genWithErrorAndItem(Expired)
	GenIncompleteErr       = genWithErrorAndItem(Incomplete)
	GenInternalErr         = genWithErrorAndItem(Internal)
	GenInvalidErr          = genWithErrorAndItem(Invalid)
	GenNotImplementedErr   = genWithErrorAndItem(NotImplemented)
	GenOutOfRangeErr       = genWithErrorAndItem(OutOfRange)
	GenPartiallyAppliedErr = genWithErrorAndItem(PartiallyApplied)
	GenTimeoutErr          = genWithErrorAndItem(Timeout)
	GenTooFewErr           = genWithErrorAndItem(TooFew)
	GenTooManyErr          = genWithErrorAndItem(TooMany)
	GenUnavailableErr      = genWithErrorAndItem(Unavailable)
)
View Source
var (
	ErrInvalidRequest     = GenInvalidErr("REQUEST", nil)
	ErrInternalServer     = GenInternalErr("SERVER", nil)
	ErrInvalidHandler     = GenInvalidErr("HANDLER", nil)
	ErrUnavailableRequest = GenUnavailableErr("REQUEST", nil)
)
View Source
var (
	ErrClusterNotSet             = fmt.Errorf("cluster is not set")
	ErrGatewayNotSet             = fmt.Errorf("gateway is not set")
	ErrTunnelNotSet              = fmt.Errorf("tunnel is not set")
	ErrUnexpectedResponse        = fmt.Errorf("unexpected response")
	ErrUnexpectedTunnelResponse  = fmt.Errorf("unexpected tunnel response")
	ErrMemberNotFound            = fmt.Errorf("member not found")
	ErrGatewayAlreadyInitialized = fmt.Errorf("gateway already initialized")
	ErrNoTunnelAddrs             = fmt.Errorf("tunnel address does not found")
	ErrRetriesExceeded           = WrapText("maximum retries exceeded")
	ErrConnectionNotExists       = fmt.Errorf("connection does not exists")
	ErrAlreadyExists             = fmt.Errorf("already exists")
	ErrEmptyObject               = fmt.Errorf("empty object")
	ErrNotFound                  = fmt.Errorf("not found")
)

Functions

func Message

func Message(reqID uint64, errCode Code, errItem string) *rony.MessageEnvelope

func New

func New(code Code, item string) *rony.Error

func NewF

func NewF(code Code, item string, format string, args ...interface{}) *rony.Error

func ToMessage

func ToMessage(out *rony.MessageEnvelope, reqID uint64, errCode Code, errItem string)

func Wrap

func Wrap(wrapper error) func(err error) error

func WrapText added in v0.16.4

func WrapText(txt string) func(err error) error

Types

type Code

type Code string
const (
	Internal         Code = "E00" // When Error is Unknown or it is internal and should not be exposed to the client
	Invalid          Code = "E01"
	Unavailable      Code = "E02"
	TooMany          Code = "E03"
	TooFew           Code = "E04"
	Incomplete       Code = "E05"
	Timeout          Code = "E06"
	Access           Code = "E07"
	AlreadyExists    Code = "E08"
	Busy             Code = "E09"
	OutOfRange       Code = "E10"
	PartiallyApplied Code = "E11"
	Expired          Code = "E12"
	NotImplemented   Code = "E13"
)

Error Codes

func (Code) HttpStatus added in v0.16.15

func (c Code) HttpStatus() int

func (Code) Name added in v0.10.5

func (c Code) Name() string

type Multi

type Multi struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Multi) AddError

func (e *Multi) AddError(err error)

func (*Multi) Error

func (e *Multi) Error() string

func (*Multi) HasError

func (e *Multi) HasError() bool

Jump to

Keyboard shortcuts

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