chore: stabilize chatwoot parity baseline

This commit is contained in:
2026-06-04 18:12:50 +08:00
parent 8ac150bc7b
commit 42cdab880c
39 changed files with 1028 additions and 696 deletions
+12 -2
View File
@@ -2,6 +2,7 @@ package v1
import (
"net/http"
"strings"
"github.com/gin-gonic/gin"
@@ -289,8 +290,17 @@ func (h *MessageHandler) Translate(c *gin.Context) {
result, svcErr := h.svc.Translate(c.Request.Context(), accountID, messageID, req)
if svcErr != nil {
handleServiceError(c, svcErr)
lower := strings.ToLower(svcErr.Error())
if strings.Contains(lower, "not found") {
response.AbortWithStatusError(c, http.StatusNotFound, response.ErrNotFound, svcErr.Error())
return
}
if strings.Contains(lower, "required") || strings.Contains(lower, "invalid") {
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrValidation, svcErr.Error())
return
}
response.AbortWithStatusError(c, http.StatusUnprocessableEntity, response.ErrInternal, svcErr.Error())
return
}
response.OK(c, result)
}
}