er

package
v0.0.0-...-c583576 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingToken means Must provide Authorization header with format `Bearer {token}`
	ErrMissingToken = NewAPPError(http.StatusUnauthorized, 40100, "Must provide Authorization header with format `Bearer {token}`")

	// ErrAuthHeaderFormat means must provide Authorization header with format `Bearer {token}`
	ErrAuthHeaderFormat = NewAPPError(http.StatusUnauthorized, 40101, "Must provide Authorization header with format `Bearer {token}`")
)

Functions

This section is empty.

Types

type APPError

type APPError struct {
	Status int         `json:"-"`
	Code   int         `json:"code"`
	Msg    string      `json:"msg"`
	Data   interface{} `json:"data,omitempty"`
}

APPError declare custom error

func NewAPPError

func NewAPPError(status int, code int, msg string) *APPError

NewAPPError new *APPError

func (*APPError) Error

func (e *APPError) Error() string

func (*APPError) WithArgs

func (e *APPError) WithArgs(a ...interface{}) *APPError

WithArgs formats according to a format specifier and returns the resulting string.

func (*APPError) WithData

func (e *APPError) WithData(data interface{}) *APPError

WithData append data into resp

func (*APPError) WithMsg

func (e *APPError) WithMsg(msg string) *APPError

WithMsg append message into APPError

Jump to

Keyboard shortcuts

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