factor out 404 handler so all 404s are the same
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
98861bc6f3
commit
9234e883e6
@ -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 {
|
func (a *Server) instanceHandler(c echo.Context) error {
|
||||||
tu := c.Param("uuid")
|
tu := c.Param("uuid")
|
||||||
u, err := uuid.Parse(tu)
|
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)
|
return c.Render(http.StatusOK, "instance.html", tc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user