func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	if err := h.handleFn(w, r); err != nil {
		status := h.status(err)
		h.handleError(r.Context(), status, err)
		var jsonErr interface{}
		if marshaler, ok := err.(json.Marshaler); ok {
			jsonErr = marshaler
		} else {
			// Fall back to string encoding
			jsonErr = err.Error()
		}
		WriteJSONResponse(w, jsonErr, status)
	}
}
// ServeHTTP implements the http.Handler interface
ServeHTTP implements the http.Handler interface
// ServeHTTP implements the http . Handler interface
func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	if err := h.handleFn(w, r); err != nil {
		status := h.status(err)
		h.handleError(r.Context(), status, err)
		var jsonErr interface{}
		if marshaler, ok := err.(json.Marshaler); ok {
			jsonErr = marshaler
		} else {
			jsonErr = err.Error()
		}
		WriteJSONResponse(w, jsonErr, status)
	}
}
func ( h handler ) ServeHTTP ( w http . ResponseWriter , r * http . Request ) { if err := h . handleFn ( w , r ) ; err != nil { status := h . status ( err ) h . handleError ( r . Context ( ) , status , err ) var jsonErr interface { } if marshaler , ok := err . ( json . Marshaler ) ; ok { jsonErr = marshaler } else { jsonErr = err . Error ( ) } WriteJSONResponse ( w , jsonErr , status ) } }
ServeHTTP implements the http.Handler interface
ServeHTTP implements the http . Handler interface
// Fall back to string encoding