class ResourceException
Same name in other branches
- 9 core/modules/media/src/OEmbed/ResourceException.php \Drupal\media\OEmbed\ResourceException
- 8.9.x core/modules/media/src/OEmbed/ResourceException.php \Drupal\media\OEmbed\ResourceException
- 10 core/modules/media/src/OEmbed/ResourceException.php \Drupal\media\OEmbed\ResourceException
Exception thrown if an oEmbed resource cannot be fetched or parsed.
@internal This is an internal part of the oEmbed system and should only be used by oEmbed-related code in Drupal core.
Hierarchy
- class \Drupal\media\OEmbed\ResourceException extends \Drupal\media\OEmbed\Exception
Expanded class hierarchy of ResourceException
6 files declare their use of ResourceException
- OEmbed.php in core/
modules/ media/ src/ Plugin/ media/ Source/ OEmbed.php - OEmbedForm.php in core/
modules/ media_library/ src/ Form/ OEmbedForm.php - OEmbedFormatter.php in core/
modules/ media/ src/ Plugin/ Field/ FieldFormatter/ OEmbedFormatter.php - OEmbedIframeController.php in core/
modules/ media/ src/ Controller/ OEmbedIframeController.php - OEmbedResourceConstraintValidator.php in core/
modules/ media/ src/ Plugin/ Validation/ Constraint/ OEmbedResourceConstraintValidator.php
File
-
core/
modules/ media/ src/ OEmbed/ ResourceException.php, line 12
Namespace
Drupal\media\OEmbedView source
class ResourceException extends \Exception {
/**
* The URL of the resource.
*
* @var string
*/
protected $url;
/**
* The resource data.
*
* @var array
*/
protected $data = [];
/**
* ResourceException constructor.
*
* @param string $message
* The exception message.
* @param string $url
* The URL of the resource. Can be the actual endpoint URL or the canonical
* URL.
* @param array $data
* (optional) The raw resource data, if available.
* @param \Exception $previous
* (optional) The previous exception, if any.
*/
public function __construct($message, $url, array $data = [], ?\Exception $previous = NULL) {
$this->url = $url;
$this->data = $data;
parent::__construct($message, 0, $previous);
}
/**
* Gets the URL of the resource which caused the exception.
*
* @return string
* The URL of the resource.
*/
public function getUrl() {
return $this->url;
}
/**
* Gets the raw resource data, if available.
*
* @return array
* The resource data.
*/
public function getData() {
return $this->data;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ResourceException::$data | protected | property | The resource data. |
ResourceException::$url | protected | property | The URL of the resource. |
ResourceException::getData | public | function | Gets the raw resource data, if available. |
ResourceException::getUrl | public | function | Gets the URL of the resource which caused the exception. |
ResourceException::__construct | public | function | ResourceException constructor. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.