errorx

package
v0.0.0-...-0e0034f Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadRequest = NewError(400, "BAD_REQUEST", "违规请求")
View Source
var ErrPhoneUnAuthorization = NewError(401, "UN_PHONE_AUTHORIZATION", "用户需要先授权登录")
View Source
var ErrUnAuthorization = NewError(401, "UN_AUTHORIZATION", "未授权")
View Source
var ErrUnKnow = NewError(500, "UN_KNOW", "未知错误, 请联系开发团队")

Functions

func NewError

func NewError(statusCode int, reason string, msg string) error

func WithCause

func WithCause(err error, cause string) error

Types

type Error

type Error struct {
	StatusCode int
	Reason     string
	Msg        string
}

func (*Error) Data

func (e *Error) Data() *ResponseErr

func (*Error) Error

func (e *Error) Error() string

func (*Error) WithCause

func (e *Error) WithCause(cause string) error

type ResponseErr

type ResponseErr struct {
	Reason string `json:"reason"`
	Msg    string `json:"msg"`
}

Jump to

Keyboard shortcuts

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