package filemanager import ( "net/http" "strconv" "strings" ) const errTemplate = ` TITLE

TITLE

Try reloading the page or hitting the back button. If this error persists, it seems that you may have found a bug! Please create an issue at hacdias/caddy-filemanager repository on GitHub with the code below.

CODE
` // PrintErrorHTML prints the error page func PrintErrorHTML(w http.ResponseWriter, code int, err error) (int, error) { tpl := errTemplate tpl = strings.Replace(tpl, "TITLE", strconv.Itoa(code)+" "+http.StatusText(code), -1) tpl = strings.Replace(tpl, "CODE", err.Error(), -1) _, err = w.Write([]byte(tpl)) if err != nil { return http.StatusInternalServerError, err } return http.StatusOK, nil }