Add more specific exceptions

This commit is contained in:
2021-01-24 18:39:26 +03:00
parent 92e8ca0812
commit caa1bab9b5
13 changed files with 98 additions and 29 deletions

View File

@@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
namespace Nsq\Exception;
use RuntimeException;
use Throwable;
final class ConnectionFail extends RuntimeException implements NsqException
{
public static function fromThrowable(Throwable $throwable): self
{
return new self($throwable->getMessage(), (int) $throwable->getCode(), $throwable);
}
}