summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/migrate/src/Plugin/Exception/BadPluginDefinitionException.php
blob: d5b25b445103e316b5c838eededf460b4d767e04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

namespace Drupal\migrate\Plugin\Exception;

use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException;

/**
 * Defines a class for bad plugin definition exceptions.
 */
class BadPluginDefinitionException extends InvalidPluginDefinitionException {

  /**
   * Constructs a BadPluginDefinitionException.
   *
   * @param string $plugin_id
   *   The plugin ID of the mapper.
   * @param string $property
   *   The name of the property that is missing from the plugin.
   * @param int $code
   *   (optional) The exception code. Defaults to 0.
   * @param \Throwable|null $previous
   *   The previous throwable used for exception chaining.
   *
   * @see \Exception
   */
  public function __construct($plugin_id, $property, $code = 0, ?\Throwable $previous = NULL) {
    $message = sprintf('The %s plugin must define the %s property.', $plugin_id, $property);
    parent::__construct($plugin_id, $message, $code, $previous);
  }

}