3 namespace Drupal\libraries\ExternalLibrary\Exception;
5 use Drupal\libraries\ExternalLibrary\Utility\LibraryAccessorTrait;
6 use Drupal\libraries\ExternalLibrary\Utility\LibraryAccessorInterface;
7 use Drupal\libraries\ExternalLibrary\Version\VersionedLibraryInterface;
10 * Provides an exception for libraries whose version has not been detected.
12 class UnknownLibraryVersionException extends \RuntimeException implements LibraryAccessorInterface {
14 use LibraryAccessorTrait;
17 * Constructs a library exception.
19 * @param \Drupal\libraries\ExternalLibrary\Version\VersionedLibraryInterface $library
21 * @param string $message
22 * (optional) The exception message.
24 * (optional) The error code.
25 * @param \Exception $previous
26 * (optional) The previous exception.
28 public function __construct(
29 VersionedLibraryInterface $library,
32 \Exception $previous = NULL
34 $this->library = $library;
35 $message = $message ?: "The version of library '{$this->library->getId()}' could not be detected.";
36 parent::__construct($message, $code, $previous);