Skip to content

Commit

Permalink
Feature/verbose exceptions (#134)
Browse files Browse the repository at this point in the history
* verbose redis exceptions

Signed-off-by: Даниил Эйзерман <[email protected]>

* composer + readme

Signed-off-by: Даниил Эйзерман <[email protected]>

* rollback composer.json and README.md

Signed-off-by: Даниил Эйзерман <[email protected]>

---------

Signed-off-by: Даниил Эйзерман <[email protected]>
Co-authored-by: Даниил Эйзерман <[email protected]>
Co-authored-by: Lukas Kämmerling <[email protected]>
  • Loading branch information
3 people authored Nov 24, 2023
1 parent 7e70ceb commit bf674d5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Prometheus/Storage/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,17 @@ private function connectToServer(): void
$connection_successful = $this->redis->connect($this->options['host'], (int) $this->options['port'], (float) $this->options['timeout']);
}
if (!$connection_successful) {
throw new StorageException("Can't connect to Redis server", 0);
throw new StorageException(
sprintf("Can't connect to Redis server. %s", $this->redis->getLastError()),
0
);
}
} catch (\RedisException $e) {
throw new StorageException("Can't connect to Redis server", 0, $e);
throw new StorageException(
sprintf("Can't connect to Redis server. %s", $e->getMessage()),
$e->getCode(),
$e
);
}
}

Expand Down

0 comments on commit bf674d5

Please sign in to comment.