error handling

This commit is contained in:
Alex
2025-02-28 10:46:40 +01:00
parent b0271f8443
commit a2e8abbf6b
6 changed files with 59 additions and 38 deletions

View File

@@ -3,6 +3,7 @@ package controllers
import (
"GoMembership/internal/services"
"GoMembership/internal/utils"
"GoMembership/pkg/errors"
"net/http"
"github.com/gin-gonic/gin"
@@ -17,7 +18,7 @@ func (lc *LicenceController) GetAllCategories(c *gin.Context) {
categories, err := lc.Service.GetAllCategories()
if err != nil {
utils.RespondWithError(c, err, "Error retrieving licence categories", http.StatusInternalServerError, "general", "server.error.internal_server_error")
utils.RespondWithError(c, err, "Error retrieving licence categories", http.StatusInternalServerError, errors.Responses.Fields.Licences, errors.Responses.Keys.InternalServerError)
return
}
c.JSON(http.StatusOK, gin.H{