btc-pay-checker/internal/api/handler/helper.go

24 lines
451 B
Go
Raw Normal View History

2023-07-19 11:47:46 +02:00
package handler
import (
"log"
"github.com/gofiber/fiber/v2"
)
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)
}