title: How to catch email already exists error on firebase 9
body: <p>hey there i have given 2 screenshots and i cannot catch the actual error message like &quot;EMAIL_EXISTS&quot;...i want to show it to the user but when i console log error.message its shows me the 1st screenshot..how can i achieve that with firebase 9...im using async await..heres my code</p>
  <pre><code>try {
  
    setLoading(true);
    const req = await createUserWithEmailAndPassword(auth, email, password);
    console.log(req)
    setLoading(false);
    dispatch({type: &quot;SIGNUP&quot;, payload: req.user})
    dispatch({
      type: &quot;visible&quot;,
      timer: 4000,
      message: &quot;Signed Up Successfully! Login Now.&quot;,
      color: &quot;SUCCESS&quot;,
    });
    dispatch({ type: &quot;login&quot; });
    return;
  } catch (error) {
    console.log(error.message)
    dispatch({
      type: &quot;visible&quot;,
      timer: 3000,
      message: &quot;Failed to Signup! Please try again&quot;,
      color: &quot;ERROR&quot;,
    });
    setLoading(false);
    return;
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/OXXD8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OXXD8.png" alt="enter image description here" /></a><a href="https://i.stack.imgur.com/MWsR8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MWsR8.png" alt="enter image description here" /></a></p>