Security/LdapAuthenticationTrait.php
protected function hideOrThrow(\Exception $e, $hideUserNotFoundExceptions)
    {
        if ($hideUserNotFoundExceptions) {
            throw new BadCredentialsException('Bad credentials.', 0, $e);
        }

        // Specifically show LdapTools related exceptions, ignore others.
        // Custom auth exception messages don't exist until Symfony 2.8, 2.7 is still under support...
        if (!$hideUserNotFoundExceptions && $e instanceof Exception && class_exists('Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException')) {
            throw new CustomUserMessageAuthenticationException($e->getMessage(), [], $e->getCode());
        }

        throw $e;
    }
protected function hideOrThrow(\Exception $e, $hideUserNotFoundExceptions)
    {
        if ($hideUserNotFoundExceptions) {
            throw new BadCredentialsException('Bad credentials.', 0, $e);
        }

        // Specifically show LdapTools related exceptions, ignore others.
        // Custom auth exception messages don't exist until Symfony 2.8, 2.7 is still under support...
        if (!$hideUserNotFoundExceptions && $e instanceof Exception && class_exists('Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException')) {
            throw new CustomUserMessageAuthenticationException($e->getMessage(), [], $e->getCode());
        }

        throw $e;
    }
Determine whether or not the exception should be masked with a BadCredentials or not.

@param \Exception $e
@param bool $hideUserNotFoundExceptions
@throws \Exception