httperror

package
v4.47.4 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 License: MIT Imports: 5 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(w http.ResponseWriter, err error)

BadRequest logs error and sets BadRequest status.

func ErrorStatus

func ErrorStatus(err error) (status int, message string)

ErrorStatus guess HTTP status and message from given error.

func Forbidden

func Forbidden(w http.ResponseWriter)

Forbidden sets Forbidden status.

func FromResponse added in v4.46.3

func FromResponse(resp *http.Response, err error) error

FromResponse wraps model's error according to given response

func FromStatus added in v4.46.2

func FromStatus(status int, err error) error

FromStatus wraps model's error according to status.

func HandleError

func HandleError(w http.ResponseWriter, err error) bool

HandleError return a status code according to given error.

func InternalServerError

func InternalServerError(w http.ResponseWriter, err error)

InternalServerError logs error and sets InternalServerError status.

func NotFound

func NotFound(w http.ResponseWriter)

NotFound sets NotFound status.

func Unauthorized

func Unauthorized(w http.ResponseWriter, err error)

Unauthorized logs error and sets Unauthorized status.

Types

This section is empty.

Jump to

Keyboard shortcuts

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