From 5ebe454ca13b91d109539e9846b4cbd51151a0ce Mon Sep 17 00:00:00 2001 From: davidhorvat Date: Thu, 29 Aug 2024 07:29:08 +0200 Subject: [PATCH] refactor: error handling --- controller/user.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/controller/user.go b/controller/user.go index 4b9e658..f74138c 100644 --- a/controller/user.go +++ b/controller/user.go @@ -61,11 +61,7 @@ func (c Controller) RegisterUser(ctx *gin.Context) { err = c.sendVerificationEmail(ctx, user) if err != nil { - c.SendResponse(ctx, Response{ - Status: http.StatusInternalServerError, - Error: err.Error(), - }) - return + log.Println("failed to send an email : ", err.Error()) } c.SendResponse(ctx, Response{ @@ -596,8 +592,7 @@ func (c Controller) sendVerificationEmail(ctx *gin.Context, user *models.User) e err = c.service.SendVerificationLinkEmail(user.EmailAddress, verificationToken.Token) if err != nil { - log.Println("failed to send an email") - return nil + return err } return nil