cerror

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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) MarshalJSON added in v1.1.3

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