er

package
v0.0.0-...-724633c Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingToken means missing token in header
	ErrMissingToken = newAPPError(http.StatusUnauthorized, 40100, "missing token in header.")

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

	// ErrExpiredToken means token is expired
	ErrExpiredToken = newAPPError(http.StatusUnauthorized, 40102, "token is expired")

	// ErrInvalidToken means token is invalid
	ErrInvalidToken = newAPPError(http.StatusUnauthorized, 40103, "token is invalid")
)
View Source
var (
	// ErrLineBaseURL means load line base url NOT an url from config
	ErrLineBaseURL = newAPPError(http.StatusInternalServerError, 50010, "load line base url NOT an url from config.")

	// ErrNewRequestByBaseURL means new a http request by base url is failure
	ErrNewRequestByBaseURL = newAPPError(http.StatusInternalServerError, 50011, "new a http request by base url is failure.")

	// ErrLineAPIURL means load line api url NOT an url from config
	ErrLineAPIURL = newAPPError(http.StatusInternalServerError, 50012, "load line api url NOT an url from config.")

	// ErrNewRequestForAccessToken means new a http request by api url is failure
	ErrNewRequestForAccessToken = newAPPError(http.StatusInternalServerError, 50013, "new a http request by api url is failure.")

	// ErrGetAccessToken means get access token from line is failure
	ErrGetAccessToken = newAPPError(http.StatusInternalServerError, 50014, "get access token from line is failure.")

	// ErrNewRequestForUserProfile means new a http request for get user profile is failure
	ErrNewRequestForUserProfile = newAPPError(http.StatusInternalServerError, 50015, "new a http request for get user profile is failure.")

	// ErrGetUserProfile means get user profile from line is failure
	ErrGetUserProfile = newAPPError(http.StatusInternalServerError, 50016, "get user profile from line is failure.")

	// ErrGetProfileByOpenID means get user profile by line open id is failure
	ErrGetProfileByOpenID = newAPPError(http.StatusInternalServerError, 50017, "get user profile by line open id is failure.")

	// ErrRegisterUser means register a user is failure
	ErrRegisterUser = newAPPError(http.StatusInternalServerError, 50018, "register a user is failure.")

	// ErrNewToken means create a new token is failure
	ErrNewToken = newAPPError(http.StatusInternalServerError, 50019, "create a new token is failure.")
)

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 (*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