2023-04-21 12:33:14 +02:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"strconv"
|
2023-05-06 21:50:35 +02:00
|
|
|
|
|
|
|
"github.com/labstack/echo/v4"
|
2023-04-21 12:33:14 +02:00
|
|
|
)
|
|
|
|
|
2023-05-06 21:50:35 +02:00
|
|
|
func renderErrorPage(c echo.Context, status int, statusText, error string) error {
|
2023-05-11 23:50:40 +02:00
|
|
|
addHeaders(c)
|
|
|
|
|
2023-04-21 12:33:14 +02:00
|
|
|
strStatus := strconv.Itoa(status)
|
|
|
|
|
2023-05-06 21:50:35 +02:00
|
|
|
return c.Render(
|
|
|
|
status,
|
|
|
|
"errorPage.tmpl",
|
2023-04-21 12:33:14 +02:00
|
|
|
page{
|
2023-05-03 02:18:29 +02:00
|
|
|
AppName: setting.AppName(),
|
2023-04-21 12:33:14 +02:00
|
|
|
AppVer: appver,
|
|
|
|
Title: fmt.Sprintf("Error %s - %s", strStatus, statusText),
|
2023-05-03 02:18:29 +02:00
|
|
|
DevelMode: setting.IsDevel(),
|
2023-04-21 12:33:14 +02:00
|
|
|
Current: strStatus,
|
|
|
|
Error: error,
|
|
|
|
Status: strStatus,
|
|
|
|
StatusText: statusText,
|
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|