diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-06-16 16:03:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-16 16:03:20 +0200 |
commit | d6cf310dfc52b81a8f15981017721d88f7fb64ed (patch) | |
tree | b2d09bbaa886713600764869d23526c2178b9da1 /apps | |
parent | 453a038e9c47d125d1a8ded93f38d082ce1cf228 (diff) | |
parent | e325209291b2f5e509638466228a2eb1e7efef5e (diff) | |
download | nextcloud-server-d6cf310dfc52b81a8f15981017721d88f7fb64ed.tar.gz nextcloud-server-d6cf310dfc52b81a8f15981017721d88f7fb64ed.zip |
Merge pull request #25104 from owncloud/dropbox-catchratelimit
Convert Dropbox Forbidden exception to StorageNotAvailableException
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/Dropbox.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/files_external/lib/Lib/Storage/Dropbox.php b/apps/files_external/lib/Lib/Storage/Dropbox.php index f15cbba0469..f0f62f9f35a 100644 --- a/apps/files_external/lib/Lib/Storage/Dropbox.php +++ b/apps/files_external/lib/Lib/Storage/Dropbox.php @@ -32,6 +32,7 @@ namespace OCA\Files_External\Lib\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 |