pcmt/handlers/error.go

30 lines
541 B
Go
Raw Normal View History

package handlers
import (
"fmt"
"strconv"
"github.com/labstack/echo/v4"
)
func renderErrorPage(c echo.Context, status int, statusText, error string) error {
2023-05-11 23:50:40 +02:00
addHeaders(c)
strStatus := strconv.Itoa(status)
return c.Render(
status,
"errorPage.tmpl",
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,
},
)
}