class RecipeMissingExtensionsException

Same name in other branches
  1. 10 core/lib/Drupal/Core/Recipe/RecipeMissingExtensionsException.php \Drupal\Core\Recipe\RecipeMissingExtensionsException

Exception thrown when recipes contain or depend on missing extensions.

@internal This API is experimental.

Hierarchy

Expanded class hierarchy of RecipeMissingExtensionsException

File

core/lib/Drupal/Core/Recipe/RecipeMissingExtensionsException.php, line 15

Namespace

Drupal\Core\Recipe
View source
final class RecipeMissingExtensionsException extends \RuntimeException {
    
    /**
     * Constructs a RecipeMissingExtensionsException.
     *
     * @param array $extensions
     *   The list of missing extensions.
     * @param string $message
     *   [optional] The Exception message to throw.
     * @param int $code
     *   [optional] The Exception code.
     * @param null|\Throwable $previous
     *   [optional] The previous throwable used for the exception chaining.
     */
    public function __construct(array $extensions, string $message = "", int $code = 0, ?\Throwable $previous = NULL) {
        assert(Inspector::assertAllStrings($extensions), 'Extension names must be strings.');
        if (!$message) {
            $sorted = $this->extensions;
            sort($sorted);
            $message = sprintf("The following extensions are missing and are required for this recipe: %s", implode(", ", $sorted));
        }
        parent::__construct($message, $code, $previous);
    }

}

Members

Title Sort descending Modifiers Object type Summary
RecipeMissingExtensionsException::__construct public function Constructs a RecipeMissingExtensionsException.

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