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
|
|
|
*/
|
2017-03-14 17:48:27 +01:00
|
|
|
class InvalidWatcherError extends \Error {
|
2016-11-06 18:38:20 +01:00
|
|
|
/** @var string */
|
|
|
|
private $watcherId;
|
2016-05-28 15:57:07 +02:00
|
|
|
|
2016-11-06 18:38:20 +01:00
|
|
|
/**
|
2017-03-10 21:58:46 +01:00
|
|
|
* @param string $watcherId The watcher identifier.
|
2016-11-06 18:38:20 +01:00
|
|
|
* @param string|null $message The exception message.
|
|
|
|
*/
|
2017-03-13 13:56:46 +01: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.
|
|
|
|
*/
|
2017-03-10 21:58:46 +01:00
|
|
|
public function getWatcherId() {
|
2016-11-06 18:38:20 +01:00
|
|
|
return $this->watcherId;
|
|
|
|
}
|
2016-05-28 15:57:07 +02:00
|
|
|
}
|