diff --git a/controllers/PlayerController.go b/controllers/PlayerController.go index 8fd167a..c84ed7a 100755 --- a/controllers/PlayerController.go +++ b/controllers/PlayerController.go @@ -24,7 +24,10 @@ func PlayerController(c echo.Context) error { } var requestValidation Request if status, err := helpers.Validate(c, &requestValidation); err != nil { - return c.String(status, err.Error()) + return c.Render(status, "error.html", echo.Map{ + "Title": "Player Error", + "Error": err.Error(), + }) } //check if requested folder exists diff --git a/inits/Server.go b/inits/Server.go index 85906b3..a01efd2 100755 --- a/inits/Server.go +++ b/inits/Server.go @@ -75,16 +75,17 @@ func Server() { app.IPExtractor = echo.ExtractIPFromXFFHeader(trustOptions...) app.HTTPErrorHandler = func(err error, c echo.Context) { - // Status code defaults to 500 code := http.StatusInternalServerError - - // Retrieve the custom status code if it's a *echo.HTTPError if he, ok := err.(*echo.HTTPError); ok { code = he.Code } - - if code == http.StatusInternalServerError { - c.Logger().Error(err) + c.Logger().Error(err) + if code == 404 { + if err := c.Render(code, "404.html", echo.Map{}); err != nil { + c.Logger().Error(err) + } + } else { + c.NoContent(code) } } diff --git a/views/404.html b/views/404.html index e8627dc..6391176 100755 --- a/views/404.html +++ b/views/404.html @@ -1,12 +1,15 @@ +
-+ {{.Error}} +
+ + + \ No newline at end of file