You are here

class LibraryTypeNotFoundException in Libraries API 8.3

Provides an exception for a library definition without a type declaration.

Hierarchy

Expanded class hierarchy of LibraryTypeNotFoundException

2 files declare their use of LibraryTypeNotFoundException
LibraryManager.php in src/ExternalLibrary/LibraryManager.php
LibraryTypeKernelTestBase.php in tests/src/Kernel/LibraryTypeKernelTestBase.php

File

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

Namespace

Drupal\libraries\ExternalLibrary\Exception
View source
class LibraryTypeNotFoundException 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 type for the library '{$this->libraryId}' could not be found.";
    parent::__construct($message, $code, $previous);
  }

}

Members

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