From: Joas Schilling Date: Wed, 11 Mar 2015 08:33:50 +0000 (+0100) Subject: Throw a RuntimeException in the cache aswell X-Git-Tag: v8.1.0alpha1~280^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2af8fea2beb44b4f7f0e4b10adf284da37936a78;p=nextcloud-server.git Throw a RuntimeException in the cache aswell --- diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php index f377e9777d6..64661ca1157 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -214,6 +214,7 @@ class Cache { * @param array $data * * @return int file id + * @throws \RuntimeException */ public function put($file, array $data) { if (($id = $this->getId($file)) > -1) { @@ -259,9 +260,12 @@ class Cache { } // The file was created in the mean time - $id = $this->getId($file); - $this->update($id, $data); - return $id; + if (($id = $this->getId($file)) > -1) { + $this->update($id, $data); + return $id; + } else { + throw new \RuntimeException('File entry exists when inserting and does not exist on select... go away'); + } } } diff --git a/lib/private/files/cache/storage.php b/lib/private/files/cache/storage.php index e5185f5c137..9f2739bbedb 100644 --- a/lib/private/files/cache/storage.php +++ b/lib/private/files/cache/storage.php @@ -21,6 +21,7 @@ class Storage { /** * @param \OC\Files\Storage\Storage|string $storage + * @throws \RuntimeException */ public function __construct($storage) { if ($storage instanceof \OC\Files\Storage\Storage) { @@ -43,7 +44,7 @@ class Storage { if ($row = $result->fetchRow()) { $this->numericId = $row['numeric_id']; } else { - throw new \Exception('Storage exists when inserting and does not exist on select... go away'); + throw new \RuntimeException('Storage exists when inserting and does not exist on select... go away'); } } }