Skip to content

Commit

Permalink
Merge pull request #324 from aurimasniekis/patch-2
Browse files Browse the repository at this point in the history
#323 Implemented error handling for PHPRedis/Client::call
  • Loading branch information
snc authored Feb 16, 2017
2 parents a18654b + 24503c7 commit 5d246d8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Client/Phpredis/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,13 @@ private function call($name, array $arguments = array())
$startTime = microtime(true);
$result = call_user_func_array("parent::$name", $arguments);
$duration = (microtime(true) - $startTime) * 1000;

$error = false;
if (false === $result) {
$error = call_user_func('parent::getLastError');
}

$this->logger->logCommand($this->getCommandString($name, $arguments), $duration, $this->alias, false);
$this->logger->logCommand($this->getCommandString($name, $arguments), $duration, $this->alias, $error);

return $result;
}
Expand Down

0 comments on commit 5d246d8

Please sign in to comment.