fix: total would always return error before
This commit is contained in:
parent
4f13a85cea
commit
dc2eab709e
|
@ -3,7 +3,6 @@ package handler
|
||||||
import (
|
import (
|
||||||
"jokes-bapak2-api/app/v1/core"
|
"jokes-bapak2-api/app/v1/core"
|
||||||
"jokes-bapak2-api/app/v1/models"
|
"jokes-bapak2-api/app/v1/models"
|
||||||
"log"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
|
@ -23,7 +22,7 @@ func TotalJokes(c *fiber.Ctx) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
total, err := memory.Get("total")
|
total, err := memory.Get("total")
|
||||||
log.Println(err)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err.Error() == "Entry not found" {
|
if err.Error() == "Entry not found" {
|
||||||
return c.Status(fiber.StatusInternalServerError).JSON(models.Error{
|
return c.Status(fiber.StatusInternalServerError).JSON(models.Error{
|
||||||
|
|
Loading…
Reference in New Issue