19 lines
319 B
Go
19 lines
319 B
Go
package handler
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
const (
|
|
defaultErrMessage = "couldn't process request"
|
|
)
|
|
|
|
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)
|
|
}
|