chore: refacto

This commit is contained in:
2026-04-20 19:41:52 +02:00
parent 5fc52c72ee
commit 2e9827af98
46 changed files with 497 additions and 648 deletions
+20
View File
@@ -0,0 +1,20 @@
package utils
import (
"log"
"net/http"
"github.com/gin-gonic/gin"
)
// BindErr log l'erreur de binding et renvoie 400 sans détails internes.
func BindErr(c *gin.Context, err error) {
log.Printf("⚠️ [BIND] %s %s: %v", c.Request.Method, c.Request.URL.Path, err)
c.JSON(http.StatusBadRequest, gin.H{"error": "Données invalides"})
}
// ServerErr log l'erreur interne et renvoie 500 avec un message générique.
func ServerErr(c *gin.Context, msg string, err error) {
log.Printf("❌ [SERVER] %s %s — %s: %v", c.Request.Method, c.Request.URL.Path, msg, err)
c.JSON(http.StatusInternalServerError, gin.H{"error": msg})
}