func ErrInvalidRequest(err error) render.Renderer {
	var errorText string
	if err != nil {
		errorText = err.Error()
	}
	return &ErrResponse{
		Err:            err,
		HTTPStatusCode: http.StatusBadRequest,
		StatusText:     "Invalid request.",
		ErrorText:      errorText,
	}
}
ErrInvalidRequest is used to indicate an error on user input (with wrapped error)
package server
import (
	"net/http"
	"github.com/go-chi/render"
)
type ErrResponse struct {
	Err            error `json:"-"`  
	HTTPStatusCode int   `json:"-"`  
	StatusText string `json:"status"`           
	AppCode    int64  `json:"code,omitempty"`   
	ErrorText  string `json:"error,omitempty"`  
}
var ErrNotFound = &ErrResponse{HTTPStatusCode: 404, StatusText: "Resource not found."}
func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error {
	render.Status(r, e.HTTPStatusCode)
	return nil
}