badresponse

package
v0.0.0-...-bef4ad1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BadRequestReason  = "非法输入"
	UnauthorizeReason = "请先登录"
	NoAccessReason    = "没有权限"
)

Variables

This section is empty.

Functions

func SetErrResponse

func SetErrResponse(ctx *gin.Context, httpStatus int, err string)

SetErrResponse set the standard err response for aborted request. 记得调用之后使用return!

Types

type ResponseError

type ResponseError struct {
	Time   time.Time `json:"time"`
	Reason string    `json:"reason"`
}

ResponseError 返回的错误

func SetResponseError

func SetResponseError(err error) (r ResponseError)

SetResponseError 通过错误获取返回的json结构

func SetResponseReason

func SetResponseReason(err string) (r ResponseError)

SetResponseReason 直接设置返回错误的信息

Jump to

Keyboard shortcuts

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