title: Managing Symfony BadCredentialsException codes
body: <p>I have a login form in my symfony project (I'm a brand noob in symfony), and I want to react differently depending on the error I get.</p>
  
  <p>I read the documentation of <a href="http://api.symfony.com/3.1/Symfony/Component/Security/Core/Exception/BadCredentialsException.html" rel="nofollow noreferrer">BadCredentialsException</a> and its parent class <a href="http://api.symfony.com/3.1/Symfony/Component/Security/Core/Exception/AuthenticationException.html" rel="nofollow noreferrer">AuthenticationException</a>, but didn't find anything about the code of the error, which I get whenever I dump <code>getLastAuthenticationError()</code> with Twig :</p>
  
  <pre><code>BadCredentialsException {#93 ▼
    -token: UsernamePasswordToken {#92 ▶}
    #message: "Bad credentials."
    #code: 0
    #file: "C:\pathToProject\vendor\symfony\symfony\src\Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider.php ◀"
    #line: 90
    -trace: {▶}
  }
  </code></pre>
  
  <p>So far I always have the 0 code. </p>
  
  <p>Is there any other codes ? Where can I find them in the doc ?</p>
  
  <p>Also, this exception seems to happen whether the password is bad or the user does not exist. Is there any way to differentiate these 2 events ?</p>