code

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrSuccess - 200: OK.
	ErrSuccess int = iota + 100001

	// ErrUnknow - 500: Internal server error.
	ErrUnknow

	// ErrBind - 400: Error occurred while binding the request body to the struct.
	ErrBind

	// ErrValidation - 400: Validation failed.
	ErrValidation

	// ErrTokenInvalid - 401: Token invalid
	ErrTokenInvalid

	// ErrPageNotFound - 404: Page not found.
	ErrPageNotFound
)
View Source
const (
	// ErrDatabase - 500: Database error.
	ErrDatabase int = iota + 100101

	// ErrRecordNotFound - 404: Record not found.
	ErrRecordNotFound

	// ErrRedis - 500: Redis error.
	ErrRedis

	// ErrCacheNotFound - 404: Cache not found.
	ErrCacheNotFound
)

common: database errors

View Source
const (
	// ErrEncrypt - 401: Error occurred while encrypting the user password.
	ErrEncrypt int = iota + 100201

	// ErrSignatureInvalid - 401: Signature is invalid.
	ErrSignatureInvalid

	// ErrExpired - 401: Token expired.
	ErrExpired

	// ErrInvalidAuthHeader - 401: Invalid authorization header.
	ErrInvalidAuthHeader

	// ErrMissingHeader - 401: The `Authorization` header was missed or empty.
	ErrMissingHeader

	// ErrPasswordIncorrect - 401: Password was incorrect.
	ErrPasswordIncorrect

	// PermissionDenied - 403: Permission denied.
	ErrPermissionDenied
)

common: authorization and authentication errors.

View Source
const (
	// ErrEncodingFailed - 500: Encoding failed due to an error with the data.
	ErrEncodingFailed int = iota + 100301

	// ErrDecodingFailed - 500: Decoding failed due to an error with the data.
	ErrDecodingFailed

	// ErrInvalidJSON - 500: Data is not valid JSON.
	ErrInvalidJSON

	// ErrEncodingJSON - 500: JSON data could not be encoded.
	ErrEncodingJSON

	// ErrDecodingJSON - 500: JSON data could not be decoded.
	ErrDecodingJSON

	// ErrInvalidYAML - 500: Data is not valid YAML.
	ErrInvalidYAML

	// ErrEncodingYAML - 500: YAML data could not be encoded.
	ErrEncodingYAML

	// ErrDecodingYAML - 500: YAML data could not be decoded.
	ErrDecodingYAML
)

common encode/decode errors.

View Source
const (
	// ErrUserNotFound - 404: User not found.
	ErrUserNotFound int = iota + 100401

	// ErrUserAlreadyExists - 400: User already exists.
	ErrUserAlreadyExists

	// ErrUserPasswordIncorrect - 401: Password was incorrect.
	ErrUserPasswordIncorrect

	// ErrUserPasswordTooShort - 400: Password is too short.
	ErrUserPasswordTooShort

	// ErrUserPasswordTooLong - 400: Password is too long.
	ErrUserPasswordTooLong

	// ErrUserPasswordInvalid - 400: Password is invalid.
	ErrUserPasswordInvalid

	// ErrUserPasswordNotMatch - 400: Password not match.
	ErrUserPasswordNotMatch

	//UserNoAuthority - 403: User no authority.
	UserNoAuthority
)

Variables

View Source
var IncludeErrCode = []int{200, 400, 401, 403, 404, 500}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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