Add error page for ratelimit

This commit is contained in:
video-prize-ranch
2022-09-10 10:11:17 -04:00
parent f0c1b7f4fe
commit 1263e66f45
6 changed files with 54 additions and 27 deletions

View File

@@ -30,12 +30,14 @@ func HandleTag(c *fiber.Ctx) error {
}
tag, err := api.FetchTag(c.Params("tag"), c.Query("sort"), page)
if err != nil && err.Error() == "ratelimited by imgur" {
return c.Status(429).Render("errors/429", nil)
}
if err != nil {
return err
}
if tag.Display == "" {
c.Status(404)
return c.Render("errors/404", nil)
return c.Status(404).Render("errors/404", nil)
}
return c.Render("tag", fiber.Map{