Files
cybertron/pkg/utils/ErrorResponse.go
2024-09-10 10:19:01 +05:30

18 lines
272 B
Go

package utils
import (
"github.com/gin-gonic/gin"
"net/http"
)
func ErrorResponse(c *gin.Context, errMsg string) {
if errMsg == "" {
errMsg = "Something went wrong"
}
c.JSON(http.StatusInternalServerError, gin.H{
"status": "error",
"message": errMsg,
})
}