func renderErrorsAsHTMLFunc(next web.HTTPHandle) web.HTTPHandle {
	return func(rw http.ResponseWriter, r *http.Request, c *ctx.Context) error {
		httpErr := httperr.Convert(next(rw, r, c))
		if httpErr != nil {
			rw.WriteHeader(httpErr.Status)
			// TODO render error as html page
			c.Printf("respond with error=%s", httpErr.Error())
			if stack := httpErr.Stacktrace; stack != "" {
				c.Printf("%s", stack)
			}
		}
		return nil
	}
}
func renderErrorsAsJSONFunc(next web.HTTPHandle) web.HTTPHandle {
	return func(rw http.ResponseWriter, r *http.Request, c *ctx.Context) error {
		httpErr := httperr.Convert(next(rw, r, c))
		if httpErr != nil {
			rw.WriteHeader(httpErr.Status)
			_ = renderJSON(rw, httpErr)
			c.Printf("error_response=%s", httpErr.Error())
			if stack := httpErr.Stacktrace; stack != "" {
				c.Printf("%s", stack)
			}
		}
		return nil
	}
}