httperror

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: MIT Imports: 5 Imported by: 2

README

Http Error

Go Http Error package

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAddressNotValid              = errors.New("address is not valid")
	ErrEmptyBody                    = errors.New("empty body")
	ErrExpectedJSONObject           = errors.New("invalid format: Expected JSON object")
	ErrRequestInterruptedByClient   = errors.New("request interrupted by the client")
	ErrValidatorNotRegistered       = errors.New("validator not registered")
	ErrRendererNotRegistered        = errors.New("renderer not registered")
	ErrInvalidRedirectCode          = errors.New("invalid redirect status code")
	ErrCookieNotFound               = errors.New("cookie not found")
	ErrInvalidCertOrKeyType         = errors.New("invalid cert or Key type, must be string or []byte")
	ErrInvalidListenerNetwork       = errors.New("invalid listener network")
	ErrUnsupportedMediaType         = New(http.StatusUnsupportedMediaType)
	ErrNotFound                     = New(http.StatusNotFound)
	ErrUnauthorized                 = New(http.StatusUnauthorized)
	ErrForbidden                    = New(http.StatusForbidden)
	ErrMethodNotAllowed             = New(http.StatusMethodNotAllowed)
	ErrStatusRequestEntityTooLarge  = New(http.StatusRequestEntityTooLarge)
	ErrTooManyRequests              = New(http.StatusTooManyRequests)
	ErrBadRequest                   = New(http.StatusBadRequest)
	ErrBadGateway                   = New(http.StatusBadGateway)
	ErrInternalServerError          = New(http.StatusInternalServerError)
	ErrRequestTimeout               = New(http.StatusRequestTimeout)
	ErrServiceUnavailable           = New(http.StatusServiceUnavailable)
	ErrPaymentRequired              = New(http.StatusPaymentRequired)
	ErrNotAcceptable                = New(http.StatusNotAcceptable)
	ErrProxyAuthRequired            = New(http.StatusProxyAuthRequired)
	ErrConflict                     = New(http.StatusConflict)
	ErrGone                         = New(http.StatusGone)
	ErrLengthRequired               = New(http.StatusLengthRequired)
	ErrPreconditionFailed           = New(http.StatusPreconditionFailed)
	ErrRequestEntityTooLarge        = New(http.StatusRequestEntityTooLarge)
	ErrRequestURITooLong            = New(http.StatusRequestURITooLong)
	ErrRequestedRangeNotSatisfiable = New(http.StatusRequestedRangeNotSatisfiable)
	ErrExpectationFailed            = New(http.StatusExpectationFailed)
	ErrUnprocessableEntity          = New(http.StatusUnprocessableEntity)
	ErrLocked                       = New(http.StatusLocked)
	ErrFailedDependency             = New(http.StatusFailedDependency)
	ErrTooEarly                     = New(http.StatusTooEarly)
	ErrUpgradeRequired              = New(http.StatusUpgradeRequired)
	ErrPreconditionRequired         = New(http.StatusPreconditionRequired)
	ErrRequestHeaderFieldsTooLarge  = New(http.StatusRequestHeaderFieldsTooLarge)
	ErrUnavailableForLegalReasons   = New(http.StatusUnavailableForLegalReasons)
	ErrNotImplemented               = New(http.StatusNotImplemented)
)

Error messages.

Functions

This section is empty.

Types

type HttpError

type HttpError interface {
	error
	StatusCode() int
	WithParams(message ...string)
	Write(w http.ResponseWriter)
}

func New added in v1.0.2

func New(status int, message ...string) HttpError

New instantiates a new HttpError.

func NewWithError added in v1.0.2

func NewWithError(status int, err error, message ...string) HttpError

NewWithError instantiates a new HttpError containing an error object as well.

Jump to

Keyboard shortcuts

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