summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-04-10 14:17:42 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-04-10 14:17:42 +0200
commit75312f96d4727d8ec91a16c48ac0aca15405513f (patch)
tree32c262c1f86de39345f3b5b0c896b3c441d13f4c /apps
parent79ef54fe00ad099944291acd869e058ce12daec6 (diff)
parentb51b5b64e65e7c9b5abd6fdb6446394a0ab34595 (diff)
downloadnextcloud-server-75312f96d4727d8ec91a16c48ac0aca15405513f.tar.gz
nextcloud-server-75312f96d4727d8ec91a16c48ac0aca15405513f.zip
Merge pull request #15530 from owncloud/davclient-catchmoreexceptions
Catch more exceptions in DAV client
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/external/storage.php25
1 files changed, 15 insertions, 10 deletions
diff --git a/apps/files_sharing/lib/external/storage.php b/apps/files_sharing/lib/external/storage.php
index 0238f5ad4af..7c1dc5aeaf5 100644
--- a/apps/files_sharing/lib/external/storage.php
+++ b/apps/files_sharing/lib/external/storage.php
@@ -199,6 +199,8 @@ class Storage extends DAV implements ISharedStorage {
$this->manager->removeShare($this->mountPoint);
$this->manager->getMountManager()->removeMount($this->mountPoint);
throw new StorageInvalidException();
+ } catch (\GuzzleHttp\Exception\ConnectException $e) {
+ throw new StorageNotAvailableException();
} catch (\GuzzleHttp\Exception\RequestException $e) {
if ($e->getCode() === 503) {
throw new StorageNotAvailableException();
@@ -246,16 +248,19 @@ class Storage extends DAV implements ISharedStorage {
// TODO: DI
$client = \OC::$server->getHTTPClientService()->newClient();
- $response = $client->post($url, ['body' => ['password' => $password]]);
-
- switch ($response->getStatusCode()) {
- case 401:
- case 403:
- throw new ForbiddenException();
- case 404:
- throw new NotFoundException();
- case 500:
- throw new \Exception();
+ try {
+ $response = $client->post($url, ['body' => ['password' => $password]]);
+ } catch (\GuzzleHttp\Exception\RequestException $e) {
+ switch ($e->getCode()) {
+ case 401:
+ case 403:
+ throw new ForbiddenException();
+ case 404:
+ throw new NotFoundException();
+ case 500:
+ throw new \Exception();
+ }
+ throw $e;
}
return json_decode($response->getBody(), true);