code

package
v0.0.0-...-5ad4795 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrInvalidAuthHeader - 400: Invalid auth header.
	ErrInvalidAuthHeader int = iota + 100701
	// ErrSignatureInvalid - 400: Signature invalid.
	ErrSignatureInvalid
)
View Source
const (
	// ErrNicknameEmpty - 400: Nickname is empty.
	ErrNicknameEmpty int = iota + 100601
	// ErrFriendAlreadyExist - 400: Friend already exist.
	ErrFriendAlreadyExist
	// ErrFriendReqAlreadyCommit - 400: Friend request already commit.
	ErrFriendReqAlreadyCommit
)
View Source
const (
	// ErrParam - 400: Param error.
	ErrParam int = iota + 100501
	// ErrTokenCreate - 400: Token create failed.
	ErrTokenCreate
	// ErrServerInternal - 500: Server internal error.
	ErrServerInternal
)
View Source
const (
	// ErrUserNotFound - 404: User not found.
	ErrUserNotFound int = iota + 100401

	// ErrUserAlreadyExists - 400: User already exists.
	ErrUserAlreadyExists

	// ErrUserPasswordIncorrect - 400: User password incorrect.
	ErrUserPasswordIncorrect

	// ErrSmsSend - 400: Send sms error.
	ErrSmsSend

	// ErrCodeNotExist - 400: Sms code incorrect or expired.
	ErrCodeNotExist

	// ErrCodeIncorrect - 400: Verify code incorrect.
	ErrCodeIncorrect
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrCode

type ErrCode struct {
	// C refers to the code of the ErrCode.
	C int

	// HTTP status that should be used for the associated error code.
	HTTP int

	// External (user) facing error text.
	Ext string

	// Ref specify the reference document.
	Ref string
}

ErrCode implements Coder interface.

func (ErrCode) Code

func (coder ErrCode) Code() int

Code returns the integer code of ErrCode.

func (ErrCode) HTTPStatus

func (coder ErrCode) HTTPStatus() int

HTTPStatus returns the associated HTTP status code, if any. Otherwise, returns 200.

func (ErrCode) Reference

func (coder ErrCode) Reference() string

Reference returns the reference document.

func (ErrCode) String

func (coder ErrCode) String() string

String implements stringer. String returns the external error message, if any.

Jump to

Keyboard shortcuts

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