hway/handlers/errors.go

17 lines
325 B
Go

package handlers
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/hway/pkg/context"
)
func ErrorHandler(err error, c echo.Context) {
if he, ok := err.(*echo.HTTPError); ok {
if he.Code == 500 {
// Log the error if needed
c.Logger().Errorf("Error: %v", he.Message)
context.RenderError(c, he)
}
}
}