Documentation
¶
Index ¶
- Constants
- func CodeToMessage(code int) string
- func InjectCodeMessage(m map[int]string)
- type Error
- func DecodeError(err error) Error
- func NewBusinessError(code int, msg string, err error) Error
- func NewError(code int, msg string, err error, errType int) Error
- func NewMsgError(code, httpCode, errType int, msg string) Error
- func NewRawError(code int, msg string, err error, errType int, httpCode int) Error
- func NewServerError(code int, msg string, err error) Error
- func NewStandardBusinessError(msg string) Error
- func NewStandardServerError(err error) Error
- type ErrorImpl
- func (e *ErrorImpl) Code() int
- func (e *ErrorImpl) Encode() error
- func (e *ErrorImpl) Error() string
- func (e *ErrorImpl) ErrorType() int
- func (e *ErrorImpl) HttpCode() int
- func (e *ErrorImpl) Msg() string
- func (e *ErrorImpl) SetErrCode(code int)
- func (e *ErrorImpl) SetErrDetail(detail string)
- func (e *ErrorImpl) SetErrMsg(msg string)
- func (e *ErrorImpl) SetErrType(errType int)
- func (e *ErrorImpl) SetHttpCode(code int)
- func (e *ErrorImpl) String() string
Constants ¶
View Source
const ( ServerError = 500 BusinessError = 5001 Success = 200 )
Variables ¶
This section is empty.
Functions ¶
func CodeToMessage ¶
func InjectCodeMessage ¶
Types ¶
type Error ¶
type Error interface { Error() string ErrorType() int Code() int Msg() string HttpCode() int String() string Encode() error }
func DecodeError ¶ added in v0.1.9
func NewMsgError ¶ added in v0.3.9
func NewRawError ¶ added in v0.2.1
func NewStandardBusinessError ¶ added in v0.2.6
func NewStandardServerError ¶ added in v0.2.3
type ErrorImpl ¶ added in v0.2.1
type ErrorImpl struct { ErrType int `json:"err_type"` ErrCode int `json:"err_code"` ErrMsg string `json:"err_msg"` // User readable information ErrDetail string `json:"err_detail"` // Developer debugging information ErrHttpCode int `json:"err_http_code"` // Http status code }
func (*ErrorImpl) SetErrCode ¶ added in v0.2.1
func (*ErrorImpl) SetErrDetail ¶ added in v0.2.1
func (*ErrorImpl) SetErrType ¶ added in v0.2.1
func (*ErrorImpl) SetHttpCode ¶ added in v0.2.1
Click to show internal directories.
Click to hide internal directories.