From 0388a5916517207f02ce840c136d10906f945ac4 Mon Sep 17 00:00:00 2001 From: Miguel Muscat Date: Wed, 8 Jul 2020 11:54:42 +0200 Subject: [PATCH] (#13) Better exception messages when getting --- src/CachePool.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CachePool.php b/src/CachePool.php index 6b76c4b..dd3c0cb 100644 --- a/src/CachePool.php +++ b/src/CachePool.php @@ -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; @@ -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 = [];