You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bit4sat/utils/gin_errors.go

20 lines
314 B
Go

package utils
import (
"log"
"github.com/gin-gonic/gin"
)
func JSONErr(c *gin.Context, status int, msg string) {
c.AbortWithStatusJSON(status, gin.H{
"status": status,
"error": msg,
})
}
func JSONErrPriv(c *gin.Context, status int, err error) {
log.Println(err)
JSONErr(c, status, "server error")
}