package handler import ( "log" "github.com/gofiber/fiber/v2" ) var defaultErrMessage = "could not process request" func RenderError(c *fiber.Ctx, err error, message string) error { if err != nil { log.Printf("renderError: %s\n", err) } return c.Render("error", fiber.Map{ "message": message, }, "") } func JSONError(c *fiber.Ctx, status int, err error, message string) error { if err != nil { log.Printf("JSONError: %s\n", err) } return c.Status(status).SendString("error: " + message) }