Convert Dropbox Forbidden exception to StorageNotAvailableException
This commit is contained in:
parent
5e6a724c5c
commit
280c288bc0
|
@ -32,6 +32,7 @@ namespace OC\Files\Storage;
|
||||||
use GuzzleHttp\Exception\RequestException;
|
use GuzzleHttp\Exception\RequestException;
|
||||||
use Icewind\Streams\IteratorDirectory;
|
use Icewind\Streams\IteratorDirectory;
|
||||||
use Icewind\Streams\RetryWrapper;
|
use Icewind\Streams\RetryWrapper;
|
||||||
|
use OCP\Files\StorageNotAvailableException;
|
||||||
|
|
||||||
require_once __DIR__ . '/../3rdparty/Dropbox/autoload.php';
|
require_once __DIR__ . '/../3rdparty/Dropbox/autoload.php';
|
||||||
|
|
||||||
|
@ -94,6 +95,8 @@ class Dropbox extends \OC\Files\Storage\Common {
|
||||||
if ($list) {
|
if ($list) {
|
||||||
try {
|
try {
|
||||||
$response = $this->dropbox->getMetaData($path);
|
$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) {
|
} catch (\Exception $exception) {
|
||||||
\OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
|
\OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
|
||||||
return false;
|
return false;
|
||||||
|
@ -127,6 +130,8 @@ class Dropbox extends \OC\Files\Storage\Common {
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
} catch (\Dropbox_Exception_Forbidden $e) {
|
||||||
|
throw new StorageNotAvailableException('Dropbox API rate limit exceeded', StorageNotAvailableException::STATUS_ERROR, $e);
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
if ($exception instanceof \Dropbox_Exception_NotFound) {
|
if ($exception instanceof \Dropbox_Exception_NotFound) {
|
||||||
// don't log, might be a file_exist check
|
// don't log, might be a file_exist check
|
||||||
|
|
Loading…
Reference in New Issue