summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-04-10 12:12:05 +0200
committerVincent Petry <pvince81@owncloud.com>2015-04-10 12:12:05 +0200
commitb51b5b64e65e7c9b5abd6fdb6446394a0ab34595 (patch)
tree0e79624208cbe27b27d625823aa3f23296eb08db /apps/files_sharing/lib
parent73afca6207f2153e8e16de6f21a314e12b324776 (diff)
downloadnextcloud-server-b51b5b64e65e7c9b5abd6fdb6446394a0ab34595.tar.gz
nextcloud-server-b51b5b64e65e7c9b5abd6fdb6446394a0ab34595.zip
Fix converting Guzzle error codes in s2s storage
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/external/storage.php23
1 files changed, 13 insertions, 10 deletions
diff --git a/apps/files_sharing/lib/external/storage.php b/apps/files_sharing/lib/external/storage.php
index 1dfef21ca75..7c1dc5aeaf5 100644
--- a/apps/files_sharing/lib/external/storage.php
+++ b/apps/files_sharing/lib/external/storage.php
@@ -248,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);