reCoreD-UI/server/response.go

22 lines
367 B
Go
Raw Normal View History

2024-04-03 14:37:15 +00:00
package server
import (
"net/http"
"github.com/gin-gonic/gin"
)
type Response struct {
Succeed bool `json:"succeed"`
Message string `json:"message"`
Data interface{} `json:"data"`
}
func errorHandler(c *gin.Context, err error) {
c.JSON(http.StatusInternalServerError, Response{
Succeed: false,
Message: err.Error(),
Data: nil,
})
}