Mercurial > hg > isophonics-drupal-site
annotate core/modules/media/src/OEmbed/ProviderException.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 129ea1e6d783 |
children |
rev | line source |
---|---|
Chris@17 | 1 <?php |
Chris@17 | 2 |
Chris@17 | 3 namespace Drupal\media\OEmbed; |
Chris@17 | 4 |
Chris@17 | 5 /** |
Chris@17 | 6 * Exception thrown if an oEmbed provider causes an error. |
Chris@17 | 7 * |
Chris@17 | 8 * @internal |
Chris@17 | 9 * This is an internal part of the oEmbed system and should only be used by |
Chris@17 | 10 * oEmbed-related code in Drupal core. |
Chris@17 | 11 */ |
Chris@17 | 12 class ProviderException extends \Exception { |
Chris@17 | 13 |
Chris@17 | 14 /** |
Chris@17 | 15 * Information about the oEmbed provider which caused the exception. |
Chris@17 | 16 * |
Chris@17 | 17 * @var \Drupal\media\OEmbed\Provider |
Chris@17 | 18 * |
Chris@17 | 19 * @see \Drupal\media\OEmbed\ProviderRepositoryInterface::get() |
Chris@17 | 20 */ |
Chris@17 | 21 protected $provider; |
Chris@17 | 22 |
Chris@17 | 23 /** |
Chris@17 | 24 * ProviderException constructor. |
Chris@17 | 25 * |
Chris@17 | 26 * @param string $message |
Chris@17 | 27 * The exception message. '@name' will be replaced with the provider name |
Chris@17 | 28 * if available, or '<unknown>' if not. |
Chris@17 | 29 * @param \Drupal\media\OEmbed\Provider $provider |
Chris@17 | 30 * (optional) The provider information. |
Chris@17 | 31 * @param \Exception $previous |
Chris@17 | 32 * (optional) The previous exception, if any. |
Chris@17 | 33 */ |
Chris@17 | 34 public function __construct($message, Provider $provider = NULL, \Exception $previous = NULL) { |
Chris@17 | 35 $this->provider = $provider; |
Chris@17 | 36 $message = str_replace('@name', $provider ? $provider->getName() : '<unknown>', $message); |
Chris@17 | 37 parent::__construct($message, 0, $previous); |
Chris@17 | 38 } |
Chris@17 | 39 |
Chris@17 | 40 } |