diff pkg/middleware/notfound.go @ 1494:04967d6565fa

Added api doc strings for the middleware package.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 04 Dec 2018 17:56:28 +0100
parents 71ba4a66ec95
children 6f9d00c8cc38
line wrap: on
line diff
--- a/pkg/middleware/notfound.go	Tue Dec 04 17:40:10 2018 +0100
+++ b/pkg/middleware/notfound.go	Tue Dec 04 17:56:28 2018 +0100
@@ -18,8 +18,12 @@
 	"net/http"
 )
 
+// ErrNotFound should be as the argument to panic if the NotFound should
+// report back a http.StatusNotFound.
 var ErrNotFound = errors.New("Not found")
 
+// NotFound creates an http.Handler which survives panic(ErrNotFound) and
+// reports http.StatusNotFound in these cases back to the calling handler.
 func NotFound(next http.Handler) http.Handler {
 	return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
 		defer func() {