Mercurial > hg > isophonics-drupal-site
diff core/modules/media/src/OEmbed/ProviderException.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/modules/media/src/OEmbed/ProviderException.php Thu Feb 28 13:21:36 2019 +0000 @@ -0,0 +1,40 @@ +<?php + +namespace Drupal\media\OEmbed; + +/** + * Exception thrown if an oEmbed provider causes an error. + * + * @internal + * This is an internal part of the oEmbed system and should only be used by + * oEmbed-related code in Drupal core. + */ +class ProviderException extends \Exception { + + /** + * Information about the oEmbed provider which caused the exception. + * + * @var \Drupal\media\OEmbed\Provider + * + * @see \Drupal\media\OEmbed\ProviderRepositoryInterface::get() + */ + protected $provider; + + /** + * ProviderException constructor. + * + * @param string $message + * The exception message. '@name' will be replaced with the provider name + * if available, or '<unknown>' if not. + * @param \Drupal\media\OEmbed\Provider $provider + * (optional) The provider information. + * @param \Exception $previous + * (optional) The previous exception, if any. + */ + public function __construct($message, Provider $provider = NULL, \Exception $previous = NULL) { + $this->provider = $provider; + $message = str_replace('@name', $provider ? $provider->getName() : '<unknown>', $message); + parent::__construct($message, 0, $previous); + } + +}