Skip to content

Commit 0909e60

Browse files
authored
Merge pull request #111 from async-interop/invalid-watcher-exception
Add InvalidWatcherException::getWatcherId
2 parents ef913fc + 871f4ef commit 0909e60

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/Loop/InvalidWatcherException.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,29 @@
99
*/
1010
class InvalidWatcherException extends \Exception
1111
{
12+
/** @var string */
13+
private $watcherId;
1214

15+
/**
16+
* @param string $watcherId The watcher identifier.
17+
* @param string|null $message The exception message.
18+
*/
19+
public function __construct($watcherId, $message = null)
20+
{
21+
$this->watcherId = $watcherId;
22+
23+
if ($message === null) {
24+
$message = "An invalid watcher idenfier has been used: '{$watcherId}'";
25+
}
26+
27+
parent::__construct($message);
28+
}
29+
30+
/**
31+
* @return string The watcher identifier.
32+
*/
33+
public function getWatcherId()
34+
{
35+
return $this->watcherId;
36+
}
1337
}

0 commit comments

Comments
 (0)