mirror of
https://github.com/cubixle/tuukoti-cli.git
synced 2026-04-24 19:54:43 +01:00
26 lines
446 B
Go
26 lines
446 B
Go
package http
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
func (h *HTTP) DefaultHandler(c echo.Context) error {
|
|
return c.Render(http.StatusOK, "index.html", nil)
|
|
}
|
|
|
|
func (h *HTTP) DefaultErrorHandler(err error, c echo.Context) {
|
|
code := http.StatusInternalServerError
|
|
if he, ok := err.(*echo.HTTPError); ok {
|
|
code = he.Code
|
|
}
|
|
|
|
h.log.Error(err)
|
|
|
|
err = c.Render(code, "error.html", nil)
|
|
if err != nil {
|
|
h.log.Error(err)
|
|
}
|
|
}
|