Remove unnecessary exception class ProcessControlException
This commit is contained in:
parent
4db3a66030
commit
0a4865f597
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Toalett\Multiprocessing\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class ProcessControlException extends RuntimeException
|
||||
{
|
||||
private function __construct(string $functionName)
|
||||
{
|
||||
parent::__construct(sprintf('call to \'%s\' failed', $functionName));
|
||||
}
|
||||
|
||||
public static function forkFailed(): self
|
||||
{
|
||||
return new self('pcntl_fork');
|
||||
}
|
||||
|
||||
public static function waitFailed(): self
|
||||
{
|
||||
return new self('pcntl_wait');
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ namespace Toalett\Multiprocessing;
|
||||
use Countable;
|
||||
use Evenement\EventEmitterInterface;
|
||||
use Evenement\EventEmitterTrait;
|
||||
use RuntimeException;
|
||||
use Throwable;
|
||||
use Toalett\Multiprocessing\Exception\ProcessControlException;
|
||||
use Toalett\Multiprocessing\ProcessControl\PCNTL;
|
||||
use Toalett\Multiprocessing\ProcessControl\ProcessControl;
|
||||
use Toalett\Multiprocessing\ProcessControl\Wait;
|
||||
@ -59,7 +59,7 @@ class Workers implements Countable, EventEmitterInterface
|
||||
{
|
||||
$fork = $this->processControl->fork();
|
||||
if ($fork->failed()) {
|
||||
throw ProcessControlException::forkFailed();
|
||||
throw new RuntimeException('Could not fork process');
|
||||
}
|
||||
|
||||
if ($fork->isChild()) {
|
||||
|
Loading…
Reference in New Issue
Block a user