Skip to content

Commit

Permalink
catch exceptions when accessing the storage
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevinrob committed Jul 17, 2015
1 parent ce2eab5 commit bd1e902
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/PrivateCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ protected function getCacheKey(RequestInterface $request)
*/
public function fetch(RequestInterface $request)
{
return $this->storage->fetch($this->getCacheKey($request));
try {
return $this->storage->fetch($this->getCacheKey($request));
} catch (\Exception $ignored) {
return null;
}
}

/**
Expand All @@ -93,6 +97,10 @@ public function fetch(RequestInterface $request)
*/
public function cache(RequestInterface $request, ResponseInterface $response)
{
return $this->storage->save($this->getCacheKey($request), $this->getCacheObject($response));
try {
return $this->storage->save($this->getCacheKey($request), $this->getCacheObject($response));
} catch (\Exception $ignored) {
return false;
}
}
}

0 comments on commit bd1e902

Please sign in to comment.