From a588a12f4faace29fc2a5d8775f01ecf36a7ae10 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 24 Nov 2015 15:28:39 +0100 Subject: [PATCH] Cache::save() handles Throwable errors --- src/Caching/Cache.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Caching/Cache.php b/src/Caching/Cache.php index 0ef120c7..1e0fccb1 100644 --- a/src/Caching/Cache.php +++ b/src/Caching/Cache.php @@ -127,6 +127,9 @@ public function save($key, $data, array $dependencies = NULL) $this->storage->lock($key); try { $data = call_user_func_array($data, array(& $dependencies)); + } catch (\Throwable $e) { + $this->storage->remove($key); + throw $e; } catch (\Exception $e) { $this->storage->remove($key); throw $e;