errno

package
v0.0.0-...-7de97a6 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuccessCode int32 = iota + 0
	ServiceErrCode
	ParamErrCode
	FuncErrCode
)

基本错误码

View Source
const (
	UserAlreadyExistErrCode int32 = iota + 10001
	UserNotExistErrCode
	AuthorizationFailedErrCode
	StructConvertFailedErrCode
	ChangeUserFollowCountErrCode
	RelationRPCErrCode
	FindUserErrCode
)

user模块错误码

View Source
const (
	//follow模块错误码
	FollowActionErrCode int32 = iota + 10101
	ActionTypeErrCode
	QueryFollowErrCode
	UserRPCErrCode
	GetFollowListErrCode
	GetFollowerListErrCode
	GetFollowSetErrCode
)

follow模块错误码

View Source
const (
	CommentActionErrCode int32 = iota + 10201
	GetCommentListErrCode
)

comment模块错误码

View Source
const (
	PublishActionErrCode int32 = iota + 10201
	PublishListErrCode
	FeedErrCode
	VideoRpcUserErrCode
	VideoRpcRelationErrCode
	VideoListNotFoundErrCode
	GetVideoListByVideoIdErrCode
)

video模块错误码

View Source
const (
	// favorite模块错误码
	FavoriteActionTypeErrCode int32 = iota + 10201
	FavoriteVideoListNotExistErrCode
	FavoriteActionErrCode
	FavoriteVideoListErrCode
	FavoriteQueryUserLikeVideoErrCode
)

favorite模块错误码

Variables

View Source
var (
	Success    = NewErrNo(SuccessCode, "Success")
	ServiceErr = NewErrNo(ServiceErrCode, "Service is unable to start successfully")
	ParamErr   = NewErrNo(ParamErrCode, "Wrong Parameter has been given")
	FuncErr    = NewErrNo(FuncErrCode, "Error!")
	// user模块错误码
	UserAlreadyExistErr      = NewErrNo(UserAlreadyExistErrCode, "User already exists")
	UserNotExistErr          = NewErrNo(UserNotExistErrCode, "User not exists")
	AuthorizationFailedErr   = NewErrNo(AuthorizationFailedErrCode, "Authorization failed")
	StructConvertFailedErr   = NewErrNo(StructConvertFailedErrCode, "Struct Convert failed")
	ChangeUserFollowCountErr = NewErrNo(ChangeUserFollowCountErrCode, "Failed to modify the follow count")
	RelationRPCErr           = NewErrNo(RelationRPCErrCode, "Failed to use relation RPC")
	FindUserErr              = NewErrNo(FindUserErrCode, "Failed to use relation RPC")
	//follow模块错误码
	FollowActionErr    = NewErrNo(FollowActionErrCode, "Follow action failed")
	ActionTypeErr      = NewErrNo(ActionTypeErrCode, "Wrong action-type has been given")
	QueryFollowErr     = NewErrNo(QueryFollowErrCode, "Query relation failed")
	UserRPCErr         = NewErrNo(UserRPCErrCode, "Failed to use user RPC")
	GetFollowListErr   = NewErrNo(GetFollowListErrCode, "Failed to get follow list")
	GetFollowerListErr = NewErrNo(GetFollowerListErrCode, "Failed to get follower list")
	GetFollowSetErr    = NewErrNo(GetFollowSetErrCode, "Failed to get follow set")
	//video模块错误码
	PublishActionErr         = NewErrNo(PublishActionErrCode, "Publish Action failed")
	PublishListErr           = NewErrNo(PublishListErrCode, "Publish List failed")
	FeedErr                  = NewErrNo(FeedErrCode, "Feed videos failed")
	VideoRpcUserErr          = NewErrNo(VideoRpcUserErrCode, "Video rpc User failed")
	VideoRpcRelationErr      = NewErrNo(VideoRpcRelationErrCode, "Video rpc relation failed")
	VideoListNotFound        = NewErrNo(VideoListNotFoundErrCode, "Video List is empty")
	GetVideoListByVideoIdErr = NewErrNo(GetVideoListByVideoIdErrCode, "Get Video List By Video Id Err")
	//favorite模块错误码
	FavoriteVideoListNotExistErr = NewErrNo(FavoriteVideoListNotExistErrCode, "Favorite not exist")
	FavoriteActionErr            = NewErrNo(FavoriteActionErrCode, "FavoriteAction failed")
	FavoriteActionTypeErr        = NewErrNo(FavoriteActionTypeErrCode, "FavoriteActionType is wrong")
	FavoriteVideoListErr         = NewErrNo(FavoriteVideoListErrCode, "FavoriteVideoListErrCode rpc List err")
	QueryUserLikeVideoErr        = NewErrNo(FavoriteQueryUserLikeVideoErrCode, "FavoriteQueryUserLikeVideoErr rpc err")
	//comment模块错误码
	CommentActionErr  = NewErrNo(CommentActionErrCode, "Comment action failed")
	GetCommentListErr = NewErrNo(GetCommentListErrCode, "Failed to get comment list")
)

错误码定义---统一在此定义-防止错误码冲突

Functions

This section is empty.

Types

type ErrNo

type ErrNo struct {
	ErrCode int32
	ErrMsg  string
}

func ConvertErr

func ConvertErr(err error) ErrNo

ConvertErr convert error to Errno

func NewErrNo

func NewErrNo(code int32, msg string) ErrNo

创建错误码信息--最基础的两个点

func (ErrNo) Error

func (e ErrNo) Error() string

func (ErrNo) WithMessage

func (e ErrNo) WithMessage(msg string) ErrNo

附加修改errno的信息

Jump to

Keyboard shortcuts

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