errors

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidCode int = iota + 1000001
	UnauthorizedCode
	ForbiddenCode
	NotFoundCode
	AlreadyExistCode
	InternalCode
	TemporaryDisabledCode
	TimeoutCode
)

normal code of application.

View Source
const (
	RouteNotFoundCode int = iota + 1100001
	BindErrorCode
	FormFileErrorCode
)

hertz code.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppError

type AppError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Inner   error  `json:"-"`
}

func NewAlreadyExistError

func NewAlreadyExistError(resourceType, content string) *AppError

func NewForbiddenError

func NewForbiddenError() *AppError

func NewHertzBindError

func NewHertzBindError(err error) *AppError

func NewHertzFormFileError

func NewHertzFormFileError(err error) *AppError

func NewInternalError

func NewInternalError(err error) *AppError

func NewInvalidError

func NewInvalidError(params ...string) *AppError

func NewNotFoundError

func NewNotFoundError(resourceType, content string) *AppError

func NewUnauthorizedError

func NewUnauthorizedError(message string) *AppError

func (*AppError) Error

func (e *AppError) Error() string

func (*AppError) GetCode

func (e *AppError) GetCode() int

type Error

type Error interface {
	error

	GetCode() int

	Error() string
}

Jump to

Keyboard shortcuts

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