errno

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrUnknown - 500: Internal server error.
	ErrUnknown int = iota + 100001

	// ErrGenerateToken - 500: Error occurred while generating token.
	ErrGenerateToken

	// ErrParseToken - 500: Error occurred while parsing from token.
	ErrParseToken

	// ErrBindAndValidation - 400: Error occurred while binding the request body to the struct or validation failed.
	ErrBindAndValidation

	// ErrDatabase - 500: Database error.
	ErrDatabase

	// ErrRedis - 500: Redis error.
	ErrRedis

	// ErrPasswordInvalid - 400: Password invalid.
	ErrPasswordInvalid

	// ErrPasswordIncorrect - 401: Password incorrect.
	ErrPasswordIncorrect

	// ErrPasswordHash - 500: Error occurred while hashing password.
	ErrPasswordHash

	// ErrClientRPCInit - 500: RPC client initialization error.
	ErrClientRPCInit

	// ErrRPCLink - 500: RPC service link error.
	ErrRPCLink

	// ErrEncodingFailed - 500: Encoding failed.
	ErrEncodingFailed

	// ErrMinio - 500: Minio error.
	ErrMinio

	// ErrOpenFormFile - 500: Open request's form file error.
	ErrOpenFormFile

	// ErrInvalidUser - 400: User does not exist.
	ErrInvalidUser

	// ErrInvalidVideo - 400: Video does not exist.
	ErrInvalidVideo
)

通用:基本错误 Code must start with 1xxxxx

View Source
const (
	ErrStatusNotFound int = iota + 100101
	ErrStatusMethodNotAllowed
	ErrStatusInternalServerError
	ErrUnauthorized
)
View Source
const ErrSuccess int32 = 0

Variables

This section is empty.

Functions

func Init

func Init()

Init register error codes defines in this source code to `github.com/marmotedu/errors`

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 `github.com/marmotedu/errors`.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.

Directories

Path Synopsis
Package main is a tool to automate the creation of code init function.
Package main is a tool to automate the creation of code init function.

Jump to

Keyboard shortcuts

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