pcmt/handlers/helper.go
leo c4d0cb209b
All checks were successful
continuous-integration/drone/push Build is passing
go: add settings struct
* let the settings struct be the single source of truth
* rm app fields that are covered by settings
* pass around a pointer to settings instead of config
* consolidate config+flags into settings on start-up
* update tests
* rm empty settings.go file

fixes #4
2023-05-03 02:18:29 +02:00

31 lines
553 B
Go

package handlers
import (
"fmt"
"io"
"strconv"
)
func renderErrorPage(wr io.Writer, status int, statusText, error string) error {
tpl := getTmpl("errorPage.tmpl")
strStatus := strconv.Itoa(status)
err := tpl.Execute(wr,
page{
AppName: setting.AppName(),
AppVer: appver,
Title: fmt.Sprintf("Error %s - %s", strStatus, statusText),
DevelMode: setting.IsDevel(),
Current: strStatus,
Error: error,
Status: strStatus,
StatusText: statusText,
},
)
if err != nil {
return err
}
return nil
}