ErrNoUId -> ErrWrongCredentials

This commit is contained in:
Daniel Krol 2022-07-06 12:44:35 -04:00
parent 02a5b9ce24
commit 3829155308
2 changed files with 2 additions and 2 deletions

View file

@ -29,7 +29,7 @@ func (s *Server) getAuthToken(w http.ResponseWriter, req *http.Request) {
} }
userId, err := s.store.GetUserId(authRequest.Email, authRequest.Password) userId, err := s.store.GetUserId(authRequest.Email, authRequest.Password)
if err == store.ErrNoUId { if err == store.ErrWrongCredentials {
errorJson(w, http.StatusUnauthorized, "No match for email and password") errorJson(w, http.StatusUnauthorized, "No match for email and password")
return return
} }

View file

@ -65,7 +65,7 @@ func TestServerAuthHandlerErrors(t *testing.T) {
expectedStatusCode: http.StatusUnauthorized, expectedStatusCode: http.StatusUnauthorized,
expectedErrorString: http.StatusText(http.StatusUnauthorized) + ": No match for email and password", expectedErrorString: http.StatusText(http.StatusUnauthorized) + ": No match for email and password",
storeErrors: TestStoreFunctionsErrors{GetUserId: store.ErrNoUId}, storeErrors: TestStoreFunctionsErrors{GetUserId: store.ErrWrongCredentials},
}, },
{ {
name: "generate token fail", name: "generate token fail",