package handler import ( "errors" "net/http" "github.com/gin-gonic/gin" "github.com/yuxingu/digital-psychology/apps/api/internal/textsafe" "github.com/yuxingu/digital-psychology/apps/api/pkg/response" ) // failTextCompliance maps textsafe rejections to HTTP 400 / code 40060. func failTextCompliance(c *gin.Context, err error) bool { if err == nil { return false } if errors.Is(err, textsafe.ErrRejected) { response.Fail(c, http.StatusBadRequest, 40060, err.Error()) return true } return false }