Documentation ¶
Overview ¶
Package httpx is a convenience wrapper around the http.ServeMux type that allows us to return errors from our handlers. see https://blog.questionable.services/article/http-handler-error-handling-revisited/ for more details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
Error is a convenience function for returning an error with an associated HTTP status code.
func HandlerFunc ¶
func HandlerFunc[E env](envFn func(r *http.Request) E, fn func(E, http.ResponseWriter, *http.Request) error) http.HandlerFunc
HandlerFunc adapts a function that returns an error to an http.HandlerFunc.
Types ¶
type StatusError ¶
StatusError represents an error with an associated HTTP status code.
func (*StatusError) Error ¶
func (se *StatusError) Error() string
Allows StatusError to satisfy the error interface.
Click to show internal directories.
Click to hide internal directories.