1
0
mirror of https://github.com/danog/amp.git synced 2024-12-02 17:37:50 +01:00
amp/lib/Loop/InvalidWatcherException.php

35 lines
923 B
PHP
Raw Normal View History

<?php
2017-03-10 19:19:32 +01:00
namespace Amp\Loop;
/**
* 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.
*/
class InvalidWatcherException extends \Exception {
/** @var string */
private $watcherId;
/**
* @param string $watcherId The watcher identifier.
* @param string|null $message The exception message.
*/
public function __construct($watcherId, $message = null) {
$this->watcherId = $watcherId;
if ($message === null) {
2017-01-03 19:16:50 +01:00
$message = "An invalid watcher identifier has been used: '{$watcherId}'";
}
parent::__construct($message);
}
/**
* @return string The watcher identifier.
*/
public function getWatcherId() {
return $this->watcherId;
}
}