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

This commit is contained in:
Jeffrey Paul 2020-04-04 18:37:30 -07:00
parent 98861bc6f3
commit 9234e883e6

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)
}