From eeddf5b203ff45b8846d4d09798f49e2b3f05da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20devkcud=20Albanese=20Junior?= Date: Fri, 22 Nov 2024 20:35:39 -0300 Subject: [PATCH] fix: Show error --- internal/controller/http/v1/component.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/controller/http/v1/component.go b/internal/controller/http/v1/component.go index ea6feb6..e57e185 100644 --- a/internal/controller/http/v1/component.go +++ b/internal/controller/http/v1/component.go @@ -159,7 +159,11 @@ func CreateComponentHandler(ctx *gin.Context) { func DeleteTrashComponentsHandler(ctx *gin.Context) { dict := translations.GetTranslation(ctx) - service.Component.ClearTrash(ctx.Keys["auth_user"].(*dto.UserProfile).ID) + if err := service.Component.ClearTrash(ctx.Keys["auth_user"].(*dto.UserProfile).ID); err != nil { + log.Print(err) + ctx.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"error": dict.InternalServerError}) + return + } ctx.JSON(http.StatusOK, gin.H{"message": dict.TrashCleared}) }