diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-06-16 17:02:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-16 17:02:42 +0200 |
commit | d55ad778ae4b18ed177901cacae5e274823494a4 (patch) | |
tree | 9ad8674739fa89a987ee46f668005eab432eae74 | |
parent | b1e60cc3490832b934a005dc8459d64e34328243 (diff) | |
parent | 5e17e992b0f2848969ee53369c6bcd7cf52d4dfa (diff) | |
download | nextcloud-server-d55ad778ae4b18ed177901cacae5e274823494a4.tar.gz nextcloud-server-d55ad778ae4b18ed177901cacae5e274823494a4.zip |
Merge pull request #25148 from owncloud/stable9-dropbox-catchratelimit
[stable9] Convert Dropbox Forbidden exception to StorageNotAvailableException
-rw-r--r-- | apps/files_external/lib/dropbox.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/dropbox.php index 8381ccbae59..bfddc98f5a3 100644 --- a/apps/files_external/lib/dropbox.php +++ b/apps/files_external/lib/dropbox.php @@ -32,6 +32,7 @@ namespace OC\Files\Storage; use GuzzleHttp\Exception\RequestException; use Icewind\Streams\IteratorDirectory; use Icewind\Streams\RetryWrapper; +use OCP\Files\StorageNotAvailableException; require_once __DIR__ . '/../3rdparty/Dropbox/autoload.php'; @@ -94,6 +95,8 @@ class Dropbox extends \OC\Files\Storage\Common { if ($list) { try { $response = $this->dropbox->getMetaData($path); + } catch (\Dropbox_Exception_Forbidden $e) { + throw new StorageNotAvailableException('Dropbox API rate limit exceeded', StorageNotAvailableException::STATUS_ERROR, $e); } catch (\Exception $exception) { \OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR); return false; @@ -127,6 +130,8 @@ class Dropbox extends \OC\Files\Storage\Common { return $response; } return null; + } catch (\Dropbox_Exception_Forbidden $e) { + throw new StorageNotAvailableException('Dropbox API rate limit exceeded', StorageNotAvailableException::STATUS_ERROR, $e); } catch (\Exception $exception) { if ($exception instanceof \Dropbox_Exception_NotFound) { // don't log, might be a file_exist check |