errz

package
v0.0.0-...-e809d31 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Success    int64 = 0
	SuccessMsg       = "success"

	FailMsg = "fail"
)
View Source
const (
	CodeInvalidParam int64 = 10000 + iota
	CodeTokenInvalid
	CodeNoPermission
	CodeRpcCall
	CodeServiceBusy
)
View Source
const (
	MsgInvalidParam = "invalid param"
	MsgRpcCall      = "rpc call failed"
	MsgServiceBusy  = "service busy"
	MsgInvalidToken = "invalid token"
)
View Source
const (
	CodeUserService int64 = 20000 + iota

	CodeSentVerification
	CodeGetVerification
	CodeWrongVerification
	CodeGenerateUid
	CodeUserExist
	CodeGenerateToken
	CodeWrongPassword
	CodeGetUserInfo
	CodeChangeAvatar
	CodeChangeBackground
	CodePublishMsgInNsq
)
View Source
const (
	CodeMerchantService int64 = 30000 + iota

	CodeGenerateMerchantId
	CodeMerchantExist
	CodeGenerateMToken
	CodeWrongPwd
	CodeGetMerchantInfo
)
View Source
const (
	CodeProductService int64 = 40000 + iota

	CodeGenerateProductId
	CodeCreateProduct
	CodeNoProduct
)
View Source
const (
	CodeOperateService int64 = 50000 + iota

	CodeGetOperateInfo
	CodeFavoriteProduct
	CodeGetFavoriteStatus
	CodeGetCommentNum
	CodeGetSaleNum
)
View Source
const (
	CodeOrderService int64 = 60000 + iota

	CodeShortage
	CodeGenerateOrderId
	CodeUpdateOrder
	CodeOrderList
)
View Source
const (
	CodePayService int64 = 70000 + iota

	CodeOrderPaid
	CodeOrderCancel
	CodeAmountWrong
	CodeGenerateAlipay
)
View Source
const (
	CodeCartService int64 = 80000 + iota

	CodeeAddProductToCart
	CodeGetCart
)

Variables

View Source
var (
	ErrUserInternal = NewErrZ(WithCode(CodeUserService), WithMsg("user service busy"))

	ErrSentVerification  = NewErrZ(WithCode(CodeSentVerification), WithMsg("send verification failed"))
	ErrGetVerification   = NewErrZ(WithCode(CodeGetVerification), WithMsg("verification expired "))
	ErrWrongVerification = NewErrZ(WithCode(CodeWrongVerification), WithMsg("verification wrong"))
	ErrGenerateUid       = NewErrZ(WithCode(CodeGenerateUid), WithMsg("generate user id failed"))
	ErrUserExist         = NewErrZ(WithCode(CodeUserExist), WithMsg("user exist"))
	ErrGenerateToken     = NewErrZ(WithCode(CodeGenerateToken), WithMsg("generate user token failed"))
	ErrWrongPassword     = NewErrZ(WithCode(CodeWrongPassword), WithMsg("wrong user password"))
	ErrGetUserInfo       = NewErrZ(WithCode(CodeGetUserInfo), WithMsg("get user info failed"))
	ErrChangeAvatar      = NewErrZ(WithCode(CodeChangeAvatar), WithMsg("change avatar failed"))
	ErrChangeBackground  = NewErrZ(WithCode(CodeChangeBackground), WithMsg("change background failed"))
	ErrPublishMsgInNsq   = NewErrZ(WithCode(CodePublishMsgInNsq), WithMsg("publish message in nsq failed"))
)
View Source
var (
	ErrMerchantInternal = NewErrZ(WithCode(CodeMerchantService), WithMsg("merchant service busy"))

	ErrGenerateMerchantId = NewErrZ(WithCode(CodeGenerateMerchantId), WithMsg("generate merchant id failed"))
	ErrMerchantExist      = NewErrZ(WithCode(CodeMerchantExist), WithMsg("merchant exist"))
	ErrGenerateMToken     = NewErrZ(WithCode(CodeGenerateMToken), WithMsg("generate merchant token failed"))
	ErrWrongPwd           = NewErrZ(WithCode(CodeWrongPwd), WithMsg("wrong merchant password"))
	ErrGetMerchantInfo    = NewErrZ(WithCode(CodeGetMerchantInfo), WithMsg("get merchant info failed"))
)
View Source
var (
	ErrProductInternal = NewErrZ(WithCode(CodeProductService), WithMsg("product service busy"))

	ErrGenerateProductId = NewErrZ(WithCode(CodeGenerateProductId), WithMsg("generate product id failed"))
	ErrCreateProduct     = NewErrZ(WithCode(CodeCreateProduct), WithMsg("create product failed"))
	ErrNoProduct         = NewErrZ(WithCode(CodeNoProduct), WithMsg("no such product"))
)
View Source
var (
	ErrOperateInternal = NewErrZ(WithCode(CodeOperateService), WithMsg("operate service busy"))

	ErrGetOperateInfo    = NewErrZ(WithCode(CodeGetOperateInfo), WithMsg("get operate info failed"))
	ErrFavoriteProduct   = NewErrZ(WithCode(CodeFavoriteProduct), WithMsg("favorite product failed"))
	ErrGetFavoriteStatus = NewErrZ(WithCode(CodeGetFavoriteStatus), WithMsg("get user favorite status failed"))
	ErrGetCommentNum     = NewErrZ(WithCode(CodeGetCommentNum), WithMsg("get comment num failed"))
	ErrGetSaleNum        = NewErrZ(WithCode(CodeGetSaleNum), WithMsg("get sale num failed"))
)
View Source
var (
	ErrOrderInternal = NewErrZ(WithCode(CodeOrderService), WithMsg("order service busy"))

	ErrShortage        = NewErrZ(WithCode(CodeShortage), WithMsg("shortage of stock"))
	ErrGenerateOrderId = NewErrZ(WithCode(CodeGenerateOrderId), WithMsg("generate order id failed"))
	ErrUpdateOrder     = NewErrZ(WithCode(CodeUpdateOrder), WithMsg("update order status failed"))
	ErrGetOrder        = NewErrZ(WithCode(CodeOrderList), WithMsg("get order failed"))
)
View Source
var (
	ErrPayInternal = NewErrZ(WithCode(CodePayService), WithMsg("pay service busy"))

	ErrOrderPaid      = NewErrZ(WithCode(CodeOrderPaid), WithMsg("order have paid"))
	ErrOrderCancel    = NewErrZ(WithCode(CodeOrderCancel), WithMsg("order have canceled"))
	ErrAmountWrong    = NewErrZ(WithCode(CodeAmountWrong), WithMsg("wrong amount"))
	ErrGenerateAlipay = NewErrZ(WithCode(CodeGenerateAlipay), WithMsg("generate alipay failed"))
)
View Source
var (
	ErrCartInternal = NewErrZ(WithCode(CodeCartService), WithMsg("cart service busy"))

	ErrAddProductToCart = NewErrZ(WithCode(CodeeAddProductToCart), WithMsg("add product to cart failed"))
	ErrGetCart          = NewErrZ(WithCode(CodeGetCart), WithMsg("get cart failed"))
)

Functions

This section is empty.

Types

type ErrZ

type ErrZ struct {
	Code int64  `json:"code"`
	Msg  string `json:"msg"`
}

func NewErrZ

func NewErrZ(options ...Option) *ErrZ

func (ErrZ) Error

func (e ErrZ) Error() string

func (ErrZ) GetCode

func (e ErrZ) GetCode() int64

type Option

type Option func(e *ErrZ)

func WithCode

func WithCode(code int64) Option

func WithErr

func WithErr(err error) Option

func WithMsg

func WithMsg(msg string) Option

Jump to

Keyboard shortcuts

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