func HandleWith(eh Handler, h http.Handler) http.Handler {
	return whroute.HandlerFunc(h,
		func(w http.ResponseWriter, r *http.Request) {
			ctx := context.WithValue(whcompat.Context(r), errHandler, eh)
			h.ServeHTTP(w, whcompat.WithContext(r, ctx))
		})
}
HandleWith binds the given eror Handler to the request contexts that pass
through the given http.Handler. wherr.Handle will use this error Handler
for handling errors. If you're using the whfatal package, you should place
a whfatal.Catch inside this handler, so this error handler can deal
with Fatal requests.
package wherr  
import (
	"log"
	"net/http"
	"github.com/spacemonkeygo/errors"
	"github.com/spacemonkeygo/errors/errhttp"
	"golang.org/x/net/context"
	"gopkg.in/webhelp.v1"
	"gopkg.in/webhelp.v1/whcompat"
	"gopkg.in/webhelp.v1/whroute"
)
var (
	HTTPError = errors.NewClass("HTTP Error", errors.NoCaptureStack())
	BadRequest                   = ErrorClass(http.StatusBadRequest)
	Unauthorized                 = ErrorClass(http.StatusUnauthorized)
	Forbidden                    = ErrorClass(http.StatusForbidden)
	NotFound                     = ErrorClass(http.StatusNotFound)
	MethodNotAllowed             = ErrorClass(http.StatusMethodNotAllowed)
	NotAcceptable                = ErrorClass(http.StatusNotAcceptable)
	RequestTimeout               = ErrorClass(http.StatusRequestTimeout)
	Conflict                     = ErrorClass(http.StatusConflict)
	Gone                         = ErrorClass(http.StatusGone)
	LengthRequired               = ErrorClass(http.StatusLengthRequired)
	PreconditionFailed           = ErrorClass(http.StatusPreconditionFailed)
	RequestEntityTooLarge        = ErrorClass(http.StatusRequestEntityTooLarge)
	RequestURITooLong            = ErrorClass(http.StatusRequestURITooLong)
	UnsupportedMediaType         = ErrorClass(http.StatusUnsupportedMediaType)
	RequestedRangeNotSatisfiable = ErrorClass(http.StatusRequestedRangeNotSatisfiable)
	ExpectationFailed            = ErrorClass(http.StatusExpectationFailed)
	Teapot                       = ErrorClass(http.StatusTeapot)
	InternalServerError          = ErrorClass(http.StatusInternalServerError)
	NotImplemented               = ErrorClass(http.StatusNotImplemented)
	BadGateway                   = ErrorClass(http.StatusBadGateway)
	ServiceUnavailable           = ErrorClass(http.StatusServiceUnavailable)
	GatewayTimeout               = ErrorClass(http.StatusGatewayTimeout)
	errHandler = webhelp.GenSym()
)
func ErrorClass(code int) *errors.ErrorClass {
	msg := http.StatusText(code)
	if msg == "" {
		msg = "Unknown error"
	}
	return HTTPError.NewClass(msg, errhttp.SetStatusCode(code))
}
func Handle(w http.ResponseWriter, r *http.Request, err error) {
	if handler, ok := whcompat.Context(r).Value(errHandler).(Handler); ok {
		handler.HandleError(w, r, err)
		return
	}
	log.Printf("error: %v", err)
	http.Error(w, errhttp.GetErrorBody(err),
		errhttp.GetStatusCode(err, http.StatusInternalServerError))
}
type Handler interface {
	HandleError(w http.ResponseWriter, r *http.Request, err error)
}