From 649b272cafaeacc0ad37b530222c4375d8d4f6b9 Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Tue, 27 Dec 2016 00:28:19 +0100 Subject: [PATCH] Use AbortWithError --- http/http.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/http/http.go b/http/http.go index edad182..d7485da 100644 --- a/http/http.go +++ b/http/http.go @@ -122,18 +122,18 @@ func (h *Handler) loginPost(c *gin.Context) { user, err := h.UserService.UserByUsername(username) if err != nil { - c.AbortWithStatus(http.StatusUnauthorized) + c.AbortWithError(http.StatusUnauthorized, err) return } if err = h.CredentialsVerifier.Verify(password, user.Password); err != nil { - c.AbortWithStatus(http.StatusUnauthorized) + c.AbortWithError(http.StatusUnauthorized, err) return } t, err := h.TokenVerifier.CreateToken(user) if err != nil { - c.AbortWithStatus(http.StatusUnauthorized) + c.AbortWithError(http.StatusUnauthorized, err) } maxAge := (int)((expiration * time.Hour).Seconds())