diff --git a/src/TinyRedisClient.php b/src/TinyRedisClient.php index 46ded57..f55d58c 100644 --- a/src/TinyRedisClient.php +++ b/src/TinyRedisClient.php @@ -38,9 +38,13 @@ public function __call($method, array $args) private function getSocket() { - return $this->socket + $socket = $this->socket ? $this->socket - : ($this->socket = stream_socket_client($this->server)); + : ($this->socket = stream_socket_client($this->server, $errno, $errstr)); + if ($socket === false) { + throw new Exception($errstr); + } + return $socket; } private function parseResponse()