diff --git a/src/Prometheus/Storage/Redis.php b/src/Prometheus/Storage/Redis.php index 5570685..40fff89 100644 --- a/src/Prometheus/Storage/Redis.php +++ b/src/Prometheus/Storage/Redis.php @@ -123,9 +123,6 @@ private function openConnection(): void } $connectionStatus = $this->connectToServer(); - if ($connectionStatus === false) { - throw new StorageException("Can't connect to Redis server", 0); - } if ($this->options['password']) { $this->redis->auth($this->options['password']); @@ -140,6 +137,8 @@ private function openConnection(): void /** * @return bool + * + * @throws StorageException */ private function connectToServer(): bool { @@ -154,7 +153,7 @@ private function connectToServer(): bool return $this->redis->connect($this->options['host'], $this->options['port'], $this->options['timeout']); } catch (\RedisException $e) { - return false; + throw new StorageException("Can't connect to Redis server", 0, $e); } }