Magento throw,  `\Magento\Framework\Exception\AlreadyExistsException` error type when we have we have **tried to a new account on an existing email address**.

    $result = $connection->fetchOne($select, $bind);
            if ($result) {
                throw new AlreadyExistsException(
                    __('A customer with the same email already exists in an associated website.')
                );
            }


So, on Controller, you can handler by this type of code

    try{
    ......
    }catch (\Magento\Framework\Exception\AlreadyExistsException $e) {
        $message = $this->__('There is already an account with this emails address. If you are sure that it is your email address, <a href="%s">click here</a> to get the password and access your account.', $url);
        $this->_getSession()->addError($message);
    }catch(\Magento\Framework\Exception\LocalizedException $e){
     $message = $e->getMessage();
     $this->_getSession()->addError($message);
    }catch (\Exception $e) {
        $message = $e->getMessage();
        $this->_getSession()->addError($message);
    }

BEIEF:
------

 
Magento2 have used little bit different type of exception handling for creating thrown exception and check the exception type.

Before the understand how to define the exception and what type of exception, Magento use then you have to check Magento in -build exception type


**Here the list exception type from [Magento/Framework/Exception][1]**

    AbstractAggregateException
    AlreadyExistsException
    AuthenticationException
    AuthorizationException
    ConfigurationMismatchException
    CouldNotDeleteException
    CouldNotSaveException
    CronException
    EmailNotConfirmedException
    FileSystemException
    InputException
    IntegrationException
    InvalidEmailOrPasswordException
    LocalizedException
    MailException
    NoSuchEntityException
    NotFoundException
    PaymentException
    RemoteServiceUnavailableException
    RuntimeException
    SecurityViolationException
    SerializationException
    SessionException
    StateException
    TemporaryStateExceptionInterface
    ValidatorException


This exceptions type are used at Magento2.

How Magento define the exception.

**Define Error type**

Suppose, you want show throw exception of already to exist then 

Then you throw error like

   

     if (Condition) {
            throw new \Magento\Framework\Exception\AlreadyExistsException(
                __('This record already exits')
            );
        }



**Check catch error Type**

Check the error **type and catch** section using below pattern:


      catch (\Magento\Framework\Exception\AlreadyExistsException $e) {
    	$this->messageManager->addError($message);
    }

**For your case you can use below catch handling logic**

    catch (\Magento\Framework\Exception\AlreadyExistsException $e) {
        $message = $this->__('There is already an account with this emails address. If you are sure that it is your email address, <a href="%s">click here</a> to get the password and access your account.', $url);
     $this->_getSession()->addError($message);
    }catch(\Magento\Framework\Exception\LocalizedException $e){
    $message = $e->getMessage();
     $this->_getSession()->addError($message);
    }catch (\Exception $e) {
                $message = $e->getMessage();
     $this->_getSession()->addError($message);
    
    }

  [1]: https://github.com/magento/magento2/tree/2.2-develop/lib/internal/Magento/Framework/Exception