feat(captain): align custom tool limits
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -42,6 +43,10 @@ func (h *CaptainCustomToolHandler) Create(c *gin.Context) {
|
||||
tool, err := h.svc.Create(c.Request.Context(), accountID, &req)
|
||||
if err != nil {
|
||||
applogger.L().Errorf("Create captain custom tool: %v", err)
|
||||
if errors.Is(err, service.ErrCaptainCustomToolLimitExceeded) {
|
||||
c.JSON(http.StatusUnprocessableEntity, gin.H{"error": service.ErrCaptainCustomToolLimitExceeded.Error()})
|
||||
return
|
||||
}
|
||||
response.AbortWithStatusError(c, http.StatusInternalServerError, response.ErrInternal, "failed to create custom tool")
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user