cerror

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefineInternalServerErrCode added in v2.3.1

func DefineInternalServerErrCode(c uint)

func DefineSuccessCode

func DefineSuccessCode(code ErrCode)

func HttpResponseError

func HttpResponseError(w http.ResponseWriter, err error)

func HttpResponseSuccess

func HttpResponseSuccess(w http.ResponseWriter, data interface{})

func HttpResponseSuccessWithCode

func HttpResponseSuccessWithCode(w http.ResponseWriter, errCode int, data interface{})

func ParseValidateError

func ParseValidateError(err error) string

func ResponseError

func ResponseError(ctx iris.Context, err error)

func ResponseSuccess

func ResponseSuccess(ctx iris.Context, data interface{})

func Validate

func Validate(v interface{}) error

Types

type ErrCode

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

func NewErrCode

func NewErrCode(code uint, httpStatusCode int) ErrCode

func (ErrCode) Code added in v2.2.0

func (e ErrCode) Code() uint

func (ErrCode) MarshalJSON

func (e ErrCode) MarshalJSON() ([]byte, error)

type Error

type Error struct {
	Code ErrCode `json:"err_code"`
	Msg  string  `json:"err_msg"`
	// contains filtered or unexported fields
}

func New

func New(code ErrCode, msg string, err error) Error

func (Error) Error

func (e Error) Error() string

func (*Error) StatusCode

func (e *Error) StatusCode() int

func (*Error) String

func (e *Error) String() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

Jump to

Keyboard shortcuts

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