Further modules included.
[yaffs-website] / web / modules / contrib / libraries / src / ExternalLibrary / Exception / UnknownLibraryVersionException.php
diff --git a/web/modules/contrib/libraries/src/ExternalLibrary/Exception/UnknownLibraryVersionException.php b/web/modules/contrib/libraries/src/ExternalLibrary/Exception/UnknownLibraryVersionException.php
new file mode 100644 (file)
index 0000000..4afe059
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+
+namespace Drupal\libraries\ExternalLibrary\Exception;
+
+use Drupal\libraries\ExternalLibrary\Utility\LibraryAccessorTrait;
+use Drupal\libraries\ExternalLibrary\Utility\LibraryAccessorInterface;
+use Drupal\libraries\ExternalLibrary\Version\VersionedLibraryInterface;
+
+/**
+ * Provides an exception for libraries whose version has not been detected.
+ */
+class UnknownLibraryVersionException extends \RuntimeException implements LibraryAccessorInterface {
+
+  use LibraryAccessorTrait;
+
+  /**
+   * Constructs a library exception.
+   *
+   * @param \Drupal\libraries\ExternalLibrary\Version\VersionedLibraryInterface $library
+   *   The library.
+   * @param string $message
+   *   (optional) The exception message.
+   * @param int $code
+   *   (optional) The error code.
+   * @param \Exception $previous
+   *   (optional) The previous exception.
+   */
+  public function __construct(
+    VersionedLibraryInterface $library,
+    $message = '',
+    $code = 0,
+    \Exception $previous = NULL
+  ) {
+    $this->library = $library;
+    $message = $message ?: "The version of library '{$this->library->getId()}' could not be detected.";
+    parent::__construct($message, $code, $previous);
+  }
+
+}