myerrors

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

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Common
	SuccessCode = 1000
	SuccessMsg  = "Success"
	//Error
	ParamErrorCode         = 1001
	InternalErrorCode      = 1002
	AuthFailedErrorCode    = 1003
	NetworkFailedErrorCode = 1004
	UnknownErrorCode       = 1005
)

Variables

View Source
var (
	Success = NewMyError(SuccessCode, "Success")
	//Common
	ServiceError = NewMyError(InternalErrorCode, "something wrong in the service")
	ParamError   = NewMyError(ParamErrorCode, "parameter error")
	// User
	UserExistedError  = NewMyError(ParamErrorCode, "user already existed")
	UserNotFoundError = NewMyError(InternalErrorCode, "user not found")
	AuthFailedError   = NewMyError(AuthFailedErrorCode, "auth failed")
	//Follow
	FollowNotFoundError = NewMyError(InternalErrorCode, "follow not found but exec unfollow")
	//Interaction
	CommentNotFoundError = NewMyError(InternalErrorCode, "comments not found")
	//Video
	VideoUploadError = NewMyError(NetworkFailedErrorCode, "Upload Failed")
)

Functions

This section is empty.

Types

type MyError

type MyError struct {
	ErrorCode int64
	ErrorMsg  string
}

func NewMyError

func NewMyError(code int64, msg string) MyError

func (MyError) AddMessage

func (e MyError) AddMessage(error string) MyError

func (MyError) Error

func (e MyError) Error() string

Jump to

Keyboard shortcuts

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