[react-moralis] non crypto login error handling

login(username, password) how do i handle error when authentication fails

    login(username, password)
      .then(() => {
        setErrorMsg("");
        history.push("/explore");
      })
      .catch((err) => {
        console.error("Error signing in.", err);
        setErrorMsg(err.toString());
      });

i’ve got this right now but the catch block isn’t called when i enter wrong username/password

1 Like

Hey @bonobo, hope you are ok.

You should take a look on this video, it might help you create a method to handle errors :face_with_monocle:

Carlos Z

1 Like