errors

package module
v0.0.0-...-f56a457 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(id, format string, a ...interface{}) error

BadRequest generates a 400 error.

func Conflict

func Conflict(id, format string, a ...interface{}) error

Conflict generates a 409 error.

func Forbidden

func Forbidden(id, format string, a ...interface{}) error

Forbidden generates a 403 error.

func InternalServerError

func InternalServerError(id, format string, a ...interface{}) error

InternalServerError generates a 500 error.

func MethodNotAllowed

func MethodNotAllowed(id, format string, a ...interface{}) error

MethodNotAllowed generates a 405 error.

func NewHttpError

func NewHttpError(id, detail string, code int32) error

New generates a custom error.

func NotFound

func NotFound(id, format string, a ...interface{}) error

NotFound generates a 404 error.

func PanicError

func PanicError(err error)

重大 error, 需要主动 panic 的:

func Timeout

func Timeout(id, format string, a ...interface{}) error

Timeout generates a 408 error.

func Unauthorized

func Unauthorized(id, format string, a ...interface{}) error

Unauthorized generates a 401 error.

Types

type HttpError

type HttpError errors.Error

类型扩展方法:

func (*HttpError) Error

func (m *HttpError) Error() string

func (*HttpError) GetCode

func (m *HttpError) GetCode() int32

func (*HttpError) GetDetail

func (m *HttpError) GetDetail() string

func (*HttpError) GetId

func (m *HttpError) GetId() string

Jump to

Keyboard shortcuts

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