21 lines
730 B
Go
21 lines
730 B
Go
package handlers
|
|
|
|
import (
|
|
apperrors "veza-backend-api/internal/errors"
|
|
"veza-backend-api/internal/response"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// RespondWithAppError répond avec une AppError au format standardisé ORIGIN_API_SPECIFICATION
|
|
// Délègue au package response pour éviter duplication
|
|
func RespondWithAppError(c *gin.Context, appErr *apperrors.AppError) {
|
|
response.RespondWithAppError(c, appErr)
|
|
}
|
|
|
|
// RespondWithError répond avec un code d'erreur et un message au format standardisé
|
|
func RespondWithError(c *gin.Context, code int, message string, details ...apperrors.ErrorDetail) {
|
|
appErr := apperrors.New(apperrors.ErrorCode(code), message)
|
|
appErr.Details = details
|
|
response.RespondWithAppError(c, appErr)
|
|
}
|