34 lines
992 B
PHP
34 lines
992 B
PHP
<?php
|
|
|
|
namespace com\fwdekker\deathnotifier\validator;
|
|
|
|
use com\fwdekker\deathnotifier\MalformedRequestException;
|
|
use Throwable;
|
|
|
|
|
|
/**
|
|
* Thrown to indicate that a request to the server contains an invalid input.
|
|
*/
|
|
class InvalidInputException extends MalformedRequestException
|
|
{
|
|
/**
|
|
* @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 `InvalidInputException`.
|
|
*
|
|
* @param string $message the message to show to the user
|
|
* @param string|null $target the input that caused the exception, or `null` if no such element could be identified
|
|
* @param Throwable|null $previous the throwable that caused this one
|
|
*/
|
|
public function __construct(string $message, ?string $target = null, ?Throwable $previous = null)
|
|
{
|
|
parent::__construct($message, previous: $previous);
|
|
|
|
$this->target = $target;
|
|
}
|
|
}
|