summaryrefslogtreecommitdiffstatshomepage
path: root/core/lib/Drupal/Core/ParamConverter/ParamNotConvertedException.php
blob: 19e8b307ac3b1e5113733446e278dc03f8239f5c (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php

namespace Drupal\Core\ParamConverter;

/**
 * Provides an exception class for a request parameter that was not converted.
 */
class ParamNotConvertedException extends \Exception {

  /**
   * The route name that was not converted.
   *
   * @var string
   */
  protected $routeName = "";

  /**
   * The raw parameters that were not converted.
   *
   * @var array
   */
  protected $rawParameters = [];

  /**
   * Constructs the ParamNotConvertedException.
   *
   * @param string $message
   *   The Exception message to throw.
   * @param int $code
   *   The Exception code.
   * @param \Throwable $previous
   *   The previous exception used for the exception chaining.
   * @param string $route_name
   *   The route name that was not converted.
   * @param array $raw_parameters
   *   The raw parameters that were not converted.
   */
  public function __construct($message = "", $code = 0, ?\Throwable $previous = NULL, $route_name = "", array $raw_parameters = []) {
    parent::__construct($message, $code, $previous);
    $this->routeName = $route_name;
    $this->rawParameters = $raw_parameters;
  }

  /**
   * Get the route name that was not converted.
   *
   * @return string
   *   The route name that was not converted.
   */
  public function getRouteName() {
    return $this->routeName;
  }

  /**
   * Get the raw parameters that were not converted.
   *
   * @return array
   *   The raw parameters that were not converted.
   */
  public function getRawParameters() {
    return $this->rawParameters;
  }

}