From dc074076525dec955353e2772c158074f97d0fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Baldeweg?= <56736413+abaldeweg@users.noreply.github.com> Date: Sat, 26 Oct 2024 09:31:59 +0000 Subject: [PATCH] Fix --- gateway/core/controllers/author.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gateway/core/controllers/author.go b/gateway/core/controllers/author.go index b98358c..0fc909f 100644 --- a/gateway/core/controllers/author.go +++ b/gateway/core/controllers/author.go @@ -34,7 +34,7 @@ func (ac *AuthorController) GetAuthors(c *gin.Context) { authors, err := ac.repo.FindAllByTerm(term) if err != nil { - c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to receive author"}) return } @@ -62,12 +62,12 @@ func (ac *AuthorController) GetAuthor(c *gin.Context) { func (ac *AuthorController) CreateAuthor(c *gin.Context) { var author models.Author if err := c.ShouldBindJSON(&author); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + c.JSON(http.StatusBadRequest, gin.H{"error": "Bad Request"}) return } if err := ac.v.Struct(author); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + c.JSON(http.StatusBadRequest, gin.H{"error": "Not Valid"}) return } @@ -89,14 +89,14 @@ func (ac *AuthorController) UpdateAuthor(c *gin.Context) { var author models.Author if err := c.ShouldBindJSON(&author); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + c.JSON(http.StatusBadRequest, gin.H{"error": "Bad Request"}) return } author.ID = id if err := ac.v.Struct(author); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + c.JSON(http.StatusBadRequest, gin.H{"error": "Not Valid"}) return }