How can I catch an EntityStorageException exception? I have a custom Webform Handler that submits a webform to an external SOAP api. Once a user submits the form, the data is sent to the external api, my custom webform hidden field 'error' is updated to read 'Yes' or 'No' depending on the feedback from the api and the form details are saved to the Drupal database. The contents of the custom 'error' field is then used to send a conditional email to the website admin. All works fine except when the SOAP api is offline, then there is an EntityStorageException error and the details in the form are neither saved to the database or submitted to the SOAP api. I've tried to Catch the EntityStorageException, but it's not working. 

My code is as follows:

namespace Drupal\mycustom_handler\Plugin\WebformHandler;

use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\Plugin\WebformHandlerBase;
use Drupal\webform\webformSubmissionInterface;
use Drupal\Core\Entity\EntityStorageException;
/**
 * Form submission handler.
 *
 * @WebformHandler(
 *   id = "sentinelapplication",
 *   label = @Translation("Sentinel Application"),
 *   category = @Translation("Form Handler"),
 *   description = @Translation("Administers application via SOAP"),
 *   cardinality = \Drupal\webform\Plugin\WebformHandlerInterface::CARDINALITY_SINGLE,
 *   results = \Drupal\webform\Plugin\WebformHandlerInterface::RESULTS_PROCESSED,
 * )
 */

class mycustom_handler extends WebformHandlerBase {
  /**
   * {@inheritdoc}
   */
  public function defaultConfiguration() {
    return [];
  }
  /**
   * {@inheritdoc}
   */
  public function preSave(WebformSubmissionInterface $webform_submission) {
    $values = $webform_submission-&gt;getData(); 
    $endpoint = 'www.soapapi.com';

    // Add the SOAP Call
    try {
      global $base_url; 
      $wsdlurl = $base_url ."/modules/custom/mycustom_handler/src/Plugin/WebformHandler/mycustom.wsdl";  
      $client = new \SoapClient($wsdlurl, array('location'=&gt;$endpoint, 'exceptions'=&gt;true, 'trace'=&gt;true));
      // upload webform detail to SOAP
      $webform_submission-&gt;setElementData('error', 'No');
    }
    catch (SoapFault $ex) {
      $webform_submission-&gt;setElementData('error', 'Yes');
    } 
    catch (Exception $ex) {
      $webform_submission-&gt;setElementData('error', 'Yes');
    } 
    catch (EntityStorageException $ex) {
      $webform_submission-&gt;setElementData('error', 'Yes');
    }
  }
}


I have also tried but had no luck with: 

catch (\EntityStorageException $ex)

catch (Drupal\Core\Entity\EntityStorageException $ex)

catch (\Drupal\Core\Entity\EntityStorageException $ex)


Not sure if it is an issue with the preSave function (and postSave function as I tried that too) because if I use the submitForm function, the error does not display and the data is saved to the Drupal database. However, while using the submitForm function solves my error problem, I can't seem to figure out how to update the custom 'error' field in the submitForm function. 

So has anyone got any idea how to Catch the EntityStorageException error or alternatively, if that is not possible, how can I update the webform submission within the submitForm function?
Thanks to Hudri, the answer to this problem was to add a backslash before SoapFault in the catch because my try/catch code is made within a local namespace and the Soap call is made in the global namespace. So my code should have been catch (\SoapFault $ex). All working now - thanks.