handler

package
v0.0.0-...-40039a6 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Recovery

func Recovery(next http.Handler) http.Handler

Recovery is a handler for handling panics

Types

type Error

type Error struct {
	Message string
	Code    int
}

Error is the message and http status code to return

func BadRequest

func BadRequest(message string) *Error

BadRequest is a convenience function for returning a bad request error

func InternalServerError

func InternalServerError() *Error

InternalServerError is a convenience function for returning an internal server error

type Handler

type Handler func(w http.ResponseWriter, r *http.Request) *Error

Handler wraps a http handler and deals with responding to errors

func (Handler) ServeHTTP

func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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