errors

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: MIT Imports: 4 Imported by: 9 modules, 9 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBadRequest

func IsBadRequest(err *Error) bool

IsBadRequest determines if err is BadRequest error.

func IsClientClosed

func IsClientClosed(err *Error) bool

IsClientClosed determines if err is ClientClosed error.

func IsConflict

func IsConflict(err *Error) bool

IsConflict determines if err is Conflict error.

func IsForbidden

func IsForbidden(err *Error) bool

IsForbidden determines if err is Forbidden error.

func IsGatewayTimeout

func IsGatewayTimeout(err *Error) bool

IsGatewayTimeout determines if err is GatewayTimeout error.

func IsInternalServer

func IsInternalServer(err *Error) bool

IsInternalServer determines if err is InternalServer error.

func IsNotFound

func IsNotFound(err *Error) bool

IsNotFound determines if err is NotFound error.

func IsServiceUnavailable

func IsServiceUnavailable(err *Error) bool

IsServiceUnavailable determines if err is ServiceUnavailable error.

func IsUnauthorized

func IsUnauthorized(err *Error) bool

IsUnauthorized determines if err is Unauthorized error.

func LogStack

func LogStack(start, end int) string

LogStack return call function stack info from start stack to end stack. if end is a positive number, return all call function stack.

Types

type Error

type Error struct {
	Code    int
	Reason  string
	Message string
	Err     error
	Stack   string
}

Error is error with info

func BadRequest

func BadRequest(reason string) *Error

BadRequest new BadRequest error

func ClientClosed

func ClientClosed(reason string) *Error

ClientClosed new ClientClosed error

func Conflict

func Conflict(reason string) *Error

Conflict new Conflict error

func Forbidden

func Forbidden(reason string) *Error

Forbidden new Forbidden error

func GatewayTimeout

func GatewayTimeout(reason string) *Error

GatewayTimeout new GatewayTimeout error

func InternalServer

func InternalServer(reason string) *Error

InternalServer new InternalServer error

func New

func New(code int, reason string) *Error

New create error

func NotFound

func NotFound(reason string) *Error

NotFound new NotFound error

func ServiceUnavailable

func ServiceUnavailable(reason string) *Error

ServiceUnavailable new ServiceUnavailable error

func Unauthorized

func Unauthorized(reason string) *Error

Unauthorized new Unauthorized error

func (*Error) Error

func (e *Error) Error() string

Error return error with info

func (*Error) Format

func (e *Error) Format(state fmt.State, verb rune)

func (*Error) WithError

func (e *Error) WithError(err error) *Error

WithError with original error

func (*Error) WithMsg

func (e *Error) WithMsg(message string) *Error

WithMsg with message

func (*Error) WithStack

func (e *Error) WithStack() *Error

WithStack with stack

Jump to

Keyboard shortcuts

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