errcode

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Success             = _eg.CreateError(0, "success")
	UnknownError        = _eg.CreateError(1, "unknown")
	ParameterError      = _eg.CreateError(2, "parameter error")
	InternalError       = _eg.CreateError(3, "internal error")
	RepositoryInitError = _eg.CreateError(4, "repository init error")
)

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    int
	Message string
	Detail  string
}

Error struct for pb.Error

func CreateError

func CreateError(code int, msg string) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(target error) bool

func (*Error) MarshalJSON

func (e *Error) MarshalJSON() ([]byte, error)

func (*Error) UnmarshalJSON

func (e *Error) UnmarshalJSON(b []byte) (err error)

func (*Error) WithDetail

func (e *Error) WithDetail(err error) *Error

func (*Error) WithDetailStr

func (e *Error) WithDetailStr(err string) *Error

func (*Error) WithDetailf added in v0.2.5

func (e *Error) WithDetailf(format string, a ...interface{}) *Error

type ErrorGroup

type ErrorGroup struct {
	Code int
	Name string
}

func NewErrorGroup

func NewErrorGroup(groupCode int, name string) *ErrorGroup

func WithErrGroup

func WithErrGroup(groupCode int) *ErrorGroup

func (*ErrorGroup) CreateError

func (e *ErrorGroup) CreateError(code int, message string) *Error

func (*ErrorGroup) IsInGroup

func (e *ErrorGroup) IsInGroup(err error) bool

Jump to

Keyboard shortcuts

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