rterr

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: GPL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeInvalid            = 400 // Invalid request
	ErrCodeNoAuth             = 401 // No authentication
	ErrCodeForbidden          = 403 // Forbidden
	ErrCodeNotFound           = 404 // Not found
	ErrCodeNoMethod           = 405 // Method not allowed
	ErrCodeUnacceptable       = 406 // Unacceptable request format
	ErrCodeProxyAuthRequired  = 407 // Proxy authentication required
	ErrCodeRQTimeout          = 408 // Request timeout
	ErrCodeTeapot             = 418 // I'm a teapot
	ErrCodeInternal           = 500 // Internal server error
	ErrCodeNYI                = 501 // Not yet implemented
	ErrCodeBadGateway         = 502 // Bad gateway interface
	ErrCodeServiceUnavailable = 503 // Service unavailable
)

Variables

This section is empty.

Functions

func IsRouterError

func IsRouterError(err error, errCode ...int) bool

Check if the error is a RouterError and if the error code matches the specified error code.

Types

type ErrorThrower

type ErrorThrower interface {
	Error(code int, message string) RouterError
	Throw(code int)
}

type RouterError

type RouterError struct {
	Message string
	Code    int
}

RouterError is a custom error type for the router.

func NewError

func NewError(code int, msg ...string) RouterError

func (RouterError) Error

func (e RouterError) Error() string

func (RouterError) IsCode

func (e RouterError) IsCode(errCode ...int) bool

Check if the error code matches the specified error code.

func (RouterError) String

func (e RouterError) String() string

Jump to

Keyboard shortcuts

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