title: Catching DisabledException when using Custom User Checker in Symfony 4.1
body: <p>I've implemented a Custom User Checker in Symfony following <a href="https://symfony.com/doc/current/security/user_checkers.html" rel="nofollow noreferrer">this guide</a>.  I need it to perform the additional check of determining if the account trying to log in is active.</p>
  
  <p>Here's my User Checker code:</p>
  
  <pre><code>class UserChecker implements UserCheckerInterface {
  
      public function checkPreAuth(UserInterface $user) {
          if (!$user-&gt;getUser()-&gt;getIsActive())  {
              throw new DisabledException("Account is disabled.");
          }  else  {
              return;
          }
      }
  
      public function checkPostAuth(UserInterface $user) {
          return;
      }
  }
  </code></pre>
  
  <p>In this case, the <code>$user</code> object that gets passed in by DI, is simply a wrapper (which implements UserInterface) of my User object.  My user object has a bool flag of <code>isActive</code>.  if <code>getIsActive</code> returns false, my condition negates that, and it should throw the <code>DisabledException</code>.</p>
  
  <p>This is not the behavior I'm seeing, however.  If I log in with an active user, I can log in fine.  If I log in with a disabled user, it simply returns me back to the log in screen (no exception thrown).</p>
  
  <p>If I change <code>DisabledException</code> to simply <code>Exception</code>, the exception is thrown, but I don't see a spot in my code where I can catch it so that I can show a pretty 'account is disabled' message to the user above the login screen.</p>
  
  <p>I'm assuming that Symfony is catching and swallowing the <code>DisabledException</code> somewhere.</p>
  
  <p>Here is my <code>security.yaml</code>:</p>
  
  <pre><code>security:
      providers:
          db_provider:
              id: database_user_provider
      encoders:
          App\Utility\Security\DatabaseUser: bcrypt
      firewalls:
          main:
              pattern: ^/
              form_login:
                  provider: db_provider
                  login_path: login
                  check_path: process_login
                  default_target_path: do_some_stuff
                  use_referer: true
              user_checker: App\Utility\Security\UserChecker
              anonymous: ~
              logout:
                  path: logout
                  target: login
  
      access_control:
      - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
      - { path: ^/register, roles: IS_AUTHENTICATED_ANONYMOUSLY }
      - { path: ^/userRegister, roles: IS_AUTHENTICATED_ANONYMOUSLY }
      - { path: ^/, roles: ROLE_USER }
  </code></pre>
  
  <p>My question is:  Where is that exception being caught / what do I need to override or implement so that I can get a message out to the user?</p>
  
  <p>or</p>
  
  <p>Where can I catch <code>Exception</code> to do the same thing?</p>