middleware

package
v0.0.0-...-080fb33 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Success     = NewError(http.StatusOK, 0, "success")
	ServerError = NewError(http.StatusInternalServerError, 200500, "系统异常,请稍后重试!")
	NotFound    = NewError(http.StatusNotFound, 200404, http.StatusText(http.StatusNotFound))
)

Functions

func ErrHandler

func ErrHandler() gin.HandlerFunc

func HandleNotFound

func HandleNotFound(c *gin.Context)

404处理

func SetUp

func SetUp() gin.HandlerFunc

Types

type Error

type Error struct {
	StatusCode int    `json:"-"`
	Code       int    `json:"code"`
	Msg        string `json:"msg"`
}

错误处理的结构体

func NewError

func NewError(statusCode, Code int, msg string) *Error

func OtherError

func OtherError(message string) *Error

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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