Skip to content

Commit 53e5e50

Browse files
committed
refactor: use conventional exception class names
1 parent 5b1f682 commit 53e5e50

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

packages/kv-store/src/Redis/PhpRedisClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function set(Stringable|string $key, mixed $value, null|Duration|DateTime
103103
}
104104

105105
if ($expiration?->isNegative()) {
106-
throw new InvalidTimeToLiveException($expiration);
106+
throw new TimeToLiveWasInvalid($expiration);
107107
}
108108

109109
$this->command('SET', ...array_filter([

packages/kv-store/src/Redis/PredisClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function set(Stringable|string $key, mixed $value, null|Duration|DateTime
6060
}
6161

6262
if ($expiration?->isNegative()) {
63-
throw new InvalidTimeToLiveException($expiration);
63+
throw new TimeToLiveWasInvalid($expiration);
6464
}
6565

6666
$this->command('SET', ...array_filter([

packages/kv-store/src/Redis/MissingRedisException.php renamed to packages/kv-store/src/Redis/ReddisExtensionWasMissing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Exception;
66
use Predis;
77

8-
final class MissingRedisException extends Exception implements RedisException
8+
final class ReddisExtensionWasMissing extends Exception implements RedisException
99
{
1010
public function __construct(string $fqcn)
1111
{

packages/kv-store/src/Redis/RedisInitializer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ public function initialize(Container $container): Redis
1919

2020
try {
2121
return new PhpRedisClient($this->buildPhpRedisClient(), $config, $bus);
22-
} catch (MissingRedisException) {
22+
} catch (ReddisExtensionWasMissing) {
2323
return new PredisClient($this->buildPredisClient($config), $bus);
2424
}
2525
}
2626

2727
private function buildPhpRedisClient(): \Redis
2828
{
2929
if (! extension_loaded('redis') || ! class_exists(\Redis::class)) {
30-
throw new MissingRedisException(\Redis::class);
30+
throw new ReddisExtensionWasMissing(\Redis::class);
3131
}
3232

3333
return new \Redis();
@@ -36,7 +36,7 @@ private function buildPhpRedisClient(): \Redis
3636
private function buildPredisClient(RedisConfig $config): Predis\Client
3737
{
3838
if (! class_exists(Predis\Client::class)) {
39-
throw new MissingRedisException(Predis\Client::class);
39+
throw new ReddisExtensionWasMissing(Predis\Client::class);
4040
}
4141

4242
return new Predis\Client(

packages/kv-store/src/Redis/InvalidTimeToLiveException.php renamed to packages/kv-store/src/Redis/TimeToLiveWasInvalid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Exception;
66
use Tempest\DateTime\Duration;
77

8-
final class InvalidTimeToLiveException extends Exception implements RedisException
8+
final class TimeToLiveWasInvalid extends Exception implements RedisException
99
{
1010
public function __construct(Duration $duration)
1111
{

0 commit comments

Comments
 (0)