feat(agents): align duplicate create errors
This commit is contained in:
@@ -111,7 +111,10 @@ func (h *AgentHandler) Create(c *gin.Context) {
|
||||
agent, svcErr := h.svc.Create(c.Request.Context(), accountID, userID, req)
|
||||
if svcErr != nil {
|
||||
if errors.Is(svcErr, repository.ErrAlreadyMember) {
|
||||
response.AbortWithStatusError(c, http.StatusConflict, response.ErrConflict, svcErr.Error())
|
||||
c.JSON(http.StatusUnprocessableEntity, gin.H{
|
||||
"message": "User has already been taken",
|
||||
"attributes": []string{"user_id"},
|
||||
})
|
||||
return
|
||||
}
|
||||
applogger.L().Errorf("Create agent for account %d: %v", accountID, svcErr)
|
||||
|
||||
Reference in New Issue
Block a user