errno

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

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

Go to latest
Published: Jan 18, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OK                  = &Errno{Code: 0, Message: "OK"}
	InternalServerError = &Errno{Code: 10000, Message: "Internal server error."}
	BindParamError      = &Errno{Code: 10001, Message: "Param error:"}

	DatabaseError    = &Errno{Code: 20000, Message: "Database error."}
	TokenInvalid     = &Errno{Code: 20001, Message: "JWT invalid."}
	SignInvalid      = &Errno{Code: 20002, Message: "Sign invalid."}
	TokenCreateError = &Errno{Code: 20003, Message: "Create JWT Error."}

	// user errors
	EncryptError       = &Errno{Code: 30000, Message: "Error occurred while encrypting the user password."}
	UserNotFound       = &Errno{Code: 30001, Message: "User not found."}
	UserExisted        = &Errno{Code: 30002, Message: "User already existed."}
	PasswordIncorrect  = &Errno{Code: 30004, Message: "Password incorrect."}
	GaoDeLocationError = &Errno{Code: 30005, Message: "GaoDe location service error."}
	GaodeWeatherError  = &Errno{Code: 30006, Message: "GaoDe weather incorrect."}
	UserUpdateError    = &Errno{Code: 30007, Message: "User update failed."}
	OSSAKSKCreateError = &Errno{Code: 30008, Message: "Create OSS AK SK error."}

	//circle errors
	CircleExisted         = &Errno{Code: 40000, Message: "Circle already existed."}
	CircleNotFound        = &Errno{Code: 40000, Message: "Circle not found."}
	UserUpdateAvatarError = &Errno{Code: 40000, Message: "update circle avatar error."}

	UploadAssetFailed    = &Errno{Code: 500000, Message: "Upload asset failed"}
	UploadDirectoryError = &Errno{Code: 500001, Message: "Upload directory error"}
)

Functions

func DecodeErr

func DecodeErr(err error) (int, string)

解析定制的错误

Types

type Err

type Err struct {
	Code    int
	Message string
	Err     error
}

Err represents an error

func New

func New(errno *Errno, err error) *Err

新建定制的错误

func (*Err) Add

func (err *Err) Add(message string) error

用来增加更多信息

func (*Err) Addf

func (err *Err) Addf(format string, args ...interface{}) error

用来增加更多信息

func (*Err) Error

func (err *Err) Error() string

type Errno

type Errno struct {
	Code    int
	Message string
}

func (*Errno) Add

func (err *Errno) Add(message string) *Errno

func (Errno) Error

func (err Errno) Error() string

Jump to

Keyboard shortcuts

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