pcmt/handlers/error.go
leo 3a2f85f683
All checks were successful
continuous-integration/drone/push Build is passing
feat: add license headers (+spdx id)
2023-05-20 20:15:57 +02:00

33 lines
635 B
Go

// Copyright 2023 wanderer <a_mirre at utb dot cz>
// SPDX-License-Identifier: AGPL-3.0-only
package handlers
import (
"fmt"
"strconv"
"github.com/labstack/echo/v4"
)
func renderErrorPage(c echo.Context, status int, statusText, error string) error {
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,
},
)
}