2016-05-28 15:57:07 +02:00
|
|
|
<?php
|
|
|
|
|
2017-03-10 19:19:32 +01:00
|
|
|
namespace Amp\Loop;
|
2016-05-28 15:57:07 +02:00
|
|
|
|
|
|
|
/**
|
2016-09-21 18:05:59 +02:00
|
|
|
* MUST be thrown if any operation (except disable() and cancel()) is attempted with an invalid watcher identifier.
|
|
|
|
*
|
|
|
|
* An invalid watcher identifier is any identifier that is not yet emitted by the driver or cancelled by the user.
|
2016-05-28 15:57:07 +02:00
|
|
|
*/
|
2020-10-09 19:37:37 +02:00
|
|
|
final class InvalidWatcherError extends \Error
|
2018-06-18 20:00:01 +02:00
|
|
|
{
|
2016-11-06 18:38:20 +01:00
|
|
|
/** @var string */
|
2020-10-09 19:37:37 +02:00
|
|
|
private string $watcherId;
|
2016-05-28 15:57:07 +02:00
|
|
|
|
2016-11-06 18:38:20 +01:00
|
|
|
/**
|
2020-03-28 12:23:46 +01:00
|
|
|
* @param string $watcherId The watcher identifier.
|
|
|
|
* @param string $message The exception message.
|
2016-11-06 18:38:20 +01:00
|
|
|
*/
|
2018-06-18 20:00:01 +02:00
|
|
|
public function __construct(string $watcherId, string $message)
|
|
|
|
{
|
2016-11-06 18:38:20 +01:00
|
|
|
$this->watcherId = $watcherId;
|
|
|
|
parent::__construct($message);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string The watcher identifier.
|
|
|
|
*/
|
2020-10-09 19:37:37 +02:00
|
|
|
public function getWatcherId(): string
|
2018-06-18 20:00:01 +02:00
|
|
|
{
|
2016-11-06 18:38:20 +01:00
|
|
|
return $this->watcherId;
|
|
|
|
}
|
2016-05-28 15:57:07 +02:00
|
|
|
}
|