diff options
author | Joas Schilling <coding@schilljs.com> | 2021-11-25 09:07:46 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-11-25 09:07:46 +0100 |
commit | 599870980bd820fc9de9832007407de2a31c31df (patch) | |
tree | 883dead537a8c575acead842145e7d6ac4e17ec5 /build/integration/features/bootstrap | |
parent | d1203e9b5d082798c2ffd1c8ae8a927626f6090a (diff) | |
download | nextcloud-server-599870980bd820fc9de9832007407de2a31c31df.tar.gz nextcloud-server-599870980bd820fc9de9832007407de2a31c31df.zip |
Correctly set the response after a ClientException as well
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'build/integration/features/bootstrap')
-rw-r--r-- | build/integration/features/bootstrap/WebDav.php | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 9f5e79a3ac6..aeae6ce3ba8 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -458,7 +458,10 @@ trait WebDav { try { $this->response = $this->makeDavRequest($user, "PUT", $destination, [], $file); } catch (\GuzzleHttp\Exception\ServerException $e) { - // 4xx and 5xx responses cause an exception + // 5xx responses cause a server exception + $this->response = $e->getResponse(); + } catch (\GuzzleHttp\Exception\ClientException $e) { + // 4xx responses cause a client exception $this->response = $e->getResponse(); } } @@ -487,7 +490,10 @@ trait WebDav { try { $this->response = $this->makeDavRequest($user, "PUT", $destination, [], $file); } catch (\GuzzleHttp\Exception\ServerException $e) { - // 4xx and 5xx responses cause an exception + // 5xx responses cause a server exception + $this->response = $e->getResponse(); + } catch (\GuzzleHttp\Exception\ClientException $e) { + // 4xx responses cause a client exception $this->response = $e->getResponse(); } } @@ -502,7 +508,10 @@ trait WebDav { try { $this->response = $this->makeDavRequest($user, 'DELETE', $file, []); } catch (\GuzzleHttp\Exception\ServerException $e) { - // 4xx and 5xx responses cause an exception + // 5xx responses cause a server exception + $this->response = $e->getResponse(); + } catch (\GuzzleHttp\Exception\ClientException $e) { + // 4xx responses cause a client exception $this->response = $e->getResponse(); } } @@ -517,7 +526,10 @@ trait WebDav { $destination = '/' . ltrim($destination, '/'); $this->response = $this->makeDavRequest($user, "MKCOL", $destination, []); } catch (\GuzzleHttp\Exception\ServerException $e) { - // 4xx and 5xx responses cause an exception + // 5xx responses cause a server exception + $this->response = $e->getResponse(); + } catch (\GuzzleHttp\Exception\ClientException $e) { + // 4xx responses cause a client exception $this->response = $e->getResponse(); } } @@ -639,8 +651,12 @@ trait WebDav { public function downloadingFileAs($fileName, $user) { try { $this->response = $this->makeDavRequest($user, 'GET', $fileName, []); - } catch (\GuzzleHttp\Exception\ServerException $ex) { - $this->response = $ex->getResponse(); + } catch (\GuzzleHttp\Exception\ServerException $e) { + // 5xx responses cause a server exception + $this->response = $e->getResponse(); + } catch (\GuzzleHttp\Exception\ClientException $e) { + // 4xx responses cause a client exception + $this->response = $e->getResponse(); } } |