errors

package
v0.0.0-...-85aee89 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknown err
	ErrUnknown = New(http.StatusInternalServerError, code.InternalServerError, "Unknow")
	// ErrUnauthorized for auth
	ErrUnauthorized = New(http.StatusUnauthorized, "", "User unauthorized")
	// ErrUserInvalid for login
	ErrUserInvalid = New(http.StatusBadRequest, "", "Wrong username or password")
	// ErrUserDisabled for login
	ErrUserDisabled = New(http.StatusForbidden, "", "The user has been disabled")
	// ErrIDClockBack clock callback
	ErrIDClockBack = New(http.StatusOK, code.IDClockBack, "Clock callback")
)
View Source
var (
	// Wrap errors.Wrap
	Wrap = errors.Wrap
	// Wrapf errors.Wrapf
	Wrapf = errors.Wrapf
	// WithStack errors.WithStack
	WithStack = errors.WithStack
	// WithMessage errors.WithMessage
	WithMessage = errors.WithMessage
	// WithMessagef errors.WithMessagef
	WithMessagef = errors.WithMessagef
)

Functions

func BadRequest

func BadRequest(message string) error

BadRequest error

func Forbidden

func Forbidden(message string) error

Forbidden error

func IllegalArgument

func IllegalArgument(message string) error

IllegalArgument error

func IllegalOperation

func IllegalOperation(message string) error

IllegalOperation error

func InternalServer

func InternalServer(message string) error

InternalServer 服务器内部错误

func New

func New(statusCode int, code string, message string) error

New error

func NoMethod

func NoMethod(method string) error

NoMethod for http method not allow 405

func NoRoute

func NoRoute(path string) error

NoRoute for http resource not found 404

func Unauthorized

func Unauthorized(message string) error

Unauthorized error

Types

type E

type E struct {
	StatusCode int
	Code       string
	Message    string
}

E is error wrapper

func Unpack

func Unpack(err error) *E

Unpack error

func (*E) Error

func (e *E) Error() string

Jump to

Keyboard shortcuts

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