factor out 404 handler so all 404s are the same
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Jeffrey Paul 2020-04-04 18:37:30 -07:00
parent 98861bc6f3
commit 9234e883e6
1 changed files with 10 additions and 0 deletions

View File

@ -88,6 +88,10 @@ func (a *Server) getInstanceListHandler() http.HandlerFunc {
}
*/
func (a *Server) notFoundHandler(c echo.Context) error {
return c.String(http.StatusNotFound, "404 not found")
}
func (a *Server) instanceHandler(c echo.Context) error {
tu := c.Param("uuid")
u, err := uuid.Parse(tu)
@ -103,6 +107,12 @@ func (a *Server) instanceHandler(c echo.Context) error {
}
}
_, exists := tc["instance"]
if !exists {
return a.notFoundHandler(c)
}
return c.Render(http.StatusOK, "instance.html", tc)
}