3 namespace Drupal\media\OEmbed;
6 * Exception thrown if an oEmbed provider causes an error.
9 * This is an internal part of the oEmbed system and should only be used by
10 * oEmbed-related code in Drupal core.
12 class ProviderException extends \Exception {
15 * Information about the oEmbed provider which caused the exception.
17 * @var \Drupal\media\OEmbed\Provider
19 * @see \Drupal\media\OEmbed\ProviderRepositoryInterface::get()
24 * ProviderException constructor.
26 * @param string $message
27 * The exception message. '@name' will be replaced with the provider name
28 * if available, or '<unknown>' if not.
29 * @param \Drupal\media\OEmbed\Provider $provider
30 * (optional) The provider information.
31 * @param \Exception $previous
32 * (optional) The previous exception, if any.
34 public function __construct($message, Provider $provider = NULL, \Exception $previous = NULL) {
35 $this->provider = $provider;
36 $message = str_replace('@name', $provider ? $provider->getName() : '<unknown>', $message);
37 parent::__construct($message, 0, $previous);