When using net/http, handling errors is kinda annoying. http.HandleFunc("/foo", func(w http.ResponseWriter, r *http.Request) { thing, err := storage.Get("thing") if err != nil { http.Error(w, err.Error(), 500) return } _ = json.NewEncoder(w).Encode(thing) }) Ideally, I could just return an error from the handler. Let’s create a type to let that happen. type MyHandlerFunc func(w http.ResponseWriter, r *http.Request) error func (f MyHandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Reques...