package utils import ( "github.com/gin-gonic/gin" "log" ) func HandleError(err error, status int, message string, c *gin.Context) { if err != nil { c.JSON(status, gin.H{"error": err}) log.Printf("%s: %v", message, err) c.Abort() } }