| 1234567891011121314151617181920212223242526 |
- package base
- import (
- "github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
- "github.com/allanpk716/ChineseSubFinder/internal/types/backend"
- "github.com/gin-gonic/gin"
- "github.com/sirupsen/logrus"
- "net/http"
- )
- type ControllerBase struct {
- log *logrus.Logger
- }
- func NewControllerBase(_logger *logrus.Logger) *ControllerBase {
- return &ControllerBase{
- log: _logger,
- }
- }
- func (cb *ControllerBase) ErrorProcess(c *gin.Context, funcName string, err error) {
- if err != nil {
- log_helper.GetLogger().Errorln(funcName, err.Error())
- c.JSON(http.StatusInternalServerError, backend.ReplyCommon{Message: err.Error()})
- }
- }
|