Skip to content

Commit

Permalink
(#13) Better exception messages when getting
Browse files Browse the repository at this point in the history
  • Loading branch information
mecha committed Jul 8, 2020
1 parent e6101dc commit 0388a59
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/CachePool.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ public function get($key, $default = null)
} catch (RangeException $e) {
return $default;
} catch (RuntimeException $e) {
throw new CacheException(sprintf('Could not retrieve cache for key "%1$s"', $key), 0, $e);
$message = sprintf('Could not retrieve cache for key "%1$s": %2$s', $key, $e->getMessage());
throw new CacheException($message, 0, $e);
}

return $value;
Expand Down Expand Up @@ -181,7 +182,7 @@ public function clear()
public function getMultiple($keys, $default = null)
{
if (!is_iterable($keys)) {
throw new InvalidArgumentException(sprintf('List of keys is not a list'));
throw new InvalidArgumentException(sprintf('List of keys is not an iterable value'));
}

$entries = [];
Expand Down

0 comments on commit 0388a59

Please sign in to comment.