You are here

class LibraryDefinitionNotFoundException in Libraries API 8.3

Provides an exception for a library definition that cannot be found.

Hierarchy

Expanded class hierarchy of LibraryDefinitionNotFoundException

5 files declare their use of LibraryDefinitionNotFoundException
ChainDefinitionDiscovery.php in src/ExternalLibrary/Definition/ChainDefinitionDiscovery.php
FileDefinitionDiscovery.php in src/ExternalLibrary/Definition/FileDefinitionDiscovery.php
FileDefinitionDiscoveryBase.php in src/ExternalLibrary/Definition/FileDefinitionDiscoveryBase.php
GuzzleDefinitionDiscovery.php in src/ExternalLibrary/Definition/GuzzleDefinitionDiscovery.php
LibraryTypeKernelTestBase.php in tests/src/Kernel/LibraryTypeKernelTestBase.php

File

src/ExternalLibrary/Exception/LibraryDefinitionNotFoundException.php, line 11

Namespace

Drupal\libraries\ExternalLibrary\Exception
View source
class LibraryDefinitionNotFoundException extends \RuntimeException implements LibraryIdAccessorInterface {
  use LibraryIdAccessorTrait;

  /**
   * Constructs a library exception.
   *
   * @param string $library_id
   *   The library ID.
   * @param string $message
   *   (optional) The exception message.
   * @param int $code
   *   (optional) The error code.
   * @param \Exception $previous
   *   (optional) The previous exception.
   */
  public function __construct($library_id, $message = '', $code = 0, \Exception $previous = NULL) {
    $this->libraryId = (string) $library_id;
    $message = $message ?: "The library definition for the library '{$this->libraryId}' could not be found.";
    parent::__construct($message, $code, $previous);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LibraryDefinitionNotFoundException::__construct public function Constructs a library exception.
LibraryIdAccessorTrait::$libraryId protected property The ID of the library.
LibraryIdAccessorTrait::getLibraryId public function Returns the ID of the library.