function OEmbedResourceConstraintValidator::handleException

Same name in other branches
  1. 9 core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php \Drupal\media\Plugin\Validation\Constraint\OEmbedResourceConstraintValidator::handleException()
  2. 8.9.x core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php \Drupal\media\Plugin\Validation\Constraint\OEmbedResourceConstraintValidator::handleException()
  3. 10 core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php \Drupal\media\Plugin\Validation\Constraint\OEmbedResourceConstraintValidator::handleException()

Handles exceptions that occur during validation.

Parameters

\Exception $e: The caught exception.

string $error_message: (optional) The error message to set as a constraint violation.

1 call to OEmbedResourceConstraintValidator::handleException()
OEmbedResourceConstraintValidator::validate in core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php

File

core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php, line 132

Class

OEmbedResourceConstraintValidator
Validates oEmbed resource URLs.

Namespace

Drupal\media\Plugin\Validation\Constraint

Code

protected function handleException(\Exception $e, $error_message = NULL) {
    if ($error_message) {
        $this->context
            ->addViolation($error_message);
    }
    // The oEmbed system makes heavy use of exception wrapping, so log the
    // entire exception chain to help with troubleshooting.
    do {
        // @todo If $e is a ProviderException or ResourceException, log additional
        // debugging information contained in those exceptions in
        // https://www.drupal.org/project/drupal/issues/2972846.
        $this->logger
            ->error($e->getMessage());
        $e = $e->getPrevious();
    } while ($e);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.