common

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitSuccess = iota
	ExitError
	ExitBadArgs = 128
)

linux保留退出代码

http://tldp.org/LDP/abs/html/exitcodes.html

Variables

View Source
var (
	ErrRunFuncNotFound             = errors.New("worker: workFunc not found")
	ErrAttemptExhausted            = errors.New("worker: the number of attempts is exhausted")
	ErrCtxCanceled                 = errors.New("worker: context canceled")
	ErrCtxDeadlineExceeded         = errors.New("worker: context deadlineExceeded")
	ErrHandlerMostBePtr            = errors.New("worker:handler must be a pointer type")
	ErrInvalidCron                 = errors.New("worker:invalid cronSchedule")
	ErrClusterRegister             = errors.New("worker:cluster register exception")
	ErrClusterUnRegister           = errors.New("worker:cluster unregister exception")
	ErrClusterBuild                = errors.New("worker:cluster build exception")
	ErrClusterRegisterInfoNotFound = errors.New("worker:cluster register info not found")
)
View Source
var (
	// ErrTryAgain 表示函数立即重试
	ErrTryAgain = errors.New("worker: [not error] func rey again")
)

Functions

func ContextErr

func ContextErr(err error) error

func ExitWithError

func ExitWithError(code int, err error)

func WithErrorMessage

func WithErrorMessage(err error, msgFmt string, args ...interface{}) error

Types

type ErrorType

type ErrorType uint64
const (
	ErrorTypeAny ErrorType = iota + 1
	ErrorTypeCtx
)

type WorkerError

type WorkerError struct {
	Inner   interface{}
	Type    ErrorType
	Message string
	Stack   string
	Data    interface{}
}

func WrapError

func WrapError(err interface{}, typ ErrorType, messagef string, msgArgs ...interface{}) WorkerError

func (WorkerError) Error

func (e WorkerError) Error() string

func (*WorkerError) IsType

func (e *WorkerError) IsType(t ErrorType) bool

func (*WorkerError) SetData

func (e *WorkerError) SetData(data interface{})

func (*WorkerError) SetStack

func (e *WorkerError) SetStack(stack string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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