code

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrSuccess - 200: OK.
	ErrSuccess int = iota + 100001
	// ErrUnknown - 500: Internal server error.
	ErrUnknown
	// ErrValidation - 400: Validation failed.
	ErrValidation
	// ErrNotFound - 404: Page not found.
	ErrNotFound
	// ErrTokenInvalid - 401: Token invalid.
	ErrTokenInvalid
	// ErrBind - 400: Error occurred while binding the request body to the struct.
	ErrBind
)

common

View Source
const (
	// ErrEncrypt - 401: Error occurred while encrypting the user password.
	ErrEncrypt int = iota + 100201
	// ErrSignatureInvalid - 401: Signature invalid.
	ErrSignatureInvalid
	// ErrInvalidAuthHeader - 401: Invalid authorization header.
	ErrInvalidAuthHeader
	// ErrMissingHeader - 401: Missing authorization header.
	ErrMissingHeader
	// ErrPasswordIncorrect - 401: Password incorrect.
	ErrPasswordIncorrect
	// ErrPermissionDenied - 403: Permission denied.
	ErrPermissionDenied
	// ErrBlackListCheck - 401: Black list check failed.
	ErrBlackListCheck
	// ErrGuardTokenCheck - 401: Guard token check failed.
	ErrGuardTokenCheck
)

jwt authorization

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: Invalid json data.
	ErrInvalidJSON
	// ErrEncodingJSON - 500: JSON data could not be encoded.
	ErrEncodingJSON
	// ErrDecodingJSON - 500: JSON data could not be decoded.
	ErrDecodingJSON
	// ErrInvalidYaml - 500: Invalid yaml data.
	ErrInvalidYaml
	// ErrEncodingYaml - 500: YAML data could not be encoded.
	ErrEncodingYaml
	// ErrDecodingYAML - 500: YAML data could not be decoded.
	ErrDecodingYAML
)

encode/decode

View Source
const (
	//ErrDatabase - 500: Database error.
	ErrDatabase int = iota + 100101
)

database

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrCode

type ErrCode struct {
	C    int
	HTTP int
	Ext  string
	Ref  string
}

func (ErrCode) Code

func (coder ErrCode) Code() int

func (ErrCode) HTTPStatus

func (coder ErrCode) HTTPStatus() int

func (ErrCode) Reference

func (coder ErrCode) Reference() string

func (ErrCode) String

func (coder ErrCode) String() string

Jump to

Keyboard shortcuts

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