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

@@ -22,9 +22,11 @@ func HandleEmbed(c *fiber.Ctx) error {
default:
post, err = api.FetchMedia(c.Params("postID"))
}
if err != nil && err.Error() == "ratelimited by imgur" {
return c.Status(429).Render("errors/429", nil)
}
if post.Id == "" || (err != nil && strings.Contains(err.Error(), "404")) {
c.Status(404)
return c.Render("errors/404", nil)
return c.Status(404).Render("errors/404", nil)
}
if err != nil {
return err