33 lines
800 B
PHP
33 lines
800 B
PHP
<?php
|
|
|
|
namespace com\fwdekker\deathnotifier\validator;
|
|
|
|
use Exception;
|
|
|
|
|
|
/**
|
|
* Thrown if an action could not be handled because an input is invalid.
|
|
*/
|
|
class ValidationException extends Exception
|
|
{
|
|
/**
|
|
* @var string|null the input element that caused the exception, or `null` if no such element could be identified
|
|
*/
|
|
public readonly ?string $target;
|
|
|
|
|
|
/**
|
|
* Constructs a new `ValidationException`.
|
|
*
|
|
* @param string $message the message to show to the user
|
|
* @param string|null $target the input element that caused the exception, or `null` if no such element could be
|
|
* identified
|
|
*/
|
|
public function __construct(string $message, ?string $target = null)
|
|
{
|
|
parent::__construct($message);
|
|
|
|
$this->target = $target;
|
|
}
|
|
}
|