feat(agents): align update validation errors
This commit is contained in:
@@ -149,6 +149,13 @@ func (h *AgentHandler) Update(c *gin.Context) {
|
||||
|
||||
agent, svcErr := h.svc.Update(c.Request.Context(), uint(id), accountID, req)
|
||||
if svcErr != nil {
|
||||
if errors.Is(svcErr, service.ErrAgentNameBlank) {
|
||||
c.JSON(http.StatusUnprocessableEntity, gin.H{
|
||||
"message": "Name can't be blank",
|
||||
"attributes": []string{"name"},
|
||||
})
|
||||
return
|
||||
}
|
||||
applogger.L().Errorf("Update agent %d for account %d: %v", id, accountID, svcErr)
|
||||
handleServiceError(c, svcErr)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user