Correctly set the response after a ClientException as well

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/30834/head
Joas Schilling 3 years ago committed by backportbot[bot]
parent 50bd62bf78
commit a02ad813b2

@ -459,7 +459,10 @@ trait WebDav {
try { try {
$this->response = $this->makeDavRequest($user, "PUT", $destination, [], $file); $this->response = $this->makeDavRequest($user, "PUT", $destination, [], $file);
} catch (\GuzzleHttp\Exception\ServerException $e) { } 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(); $this->response = $e->getResponse();
} }
} }
@ -488,7 +491,10 @@ trait WebDav {
try { try {
$this->response = $this->makeDavRequest($user, "PUT", $destination, [], $file); $this->response = $this->makeDavRequest($user, "PUT", $destination, [], $file);
} catch (\GuzzleHttp\Exception\ServerException $e) { } 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(); $this->response = $e->getResponse();
} }
} }
@ -503,7 +509,10 @@ trait WebDav {
try { try {
$this->response = $this->makeDavRequest($user, 'DELETE', $file, []); $this->response = $this->makeDavRequest($user, 'DELETE', $file, []);
} catch (\GuzzleHttp\Exception\ServerException $e) { } 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(); $this->response = $e->getResponse();
} }
} }
@ -518,7 +527,10 @@ trait WebDav {
$destination = '/' . ltrim($destination, '/'); $destination = '/' . ltrim($destination, '/');
$this->response = $this->makeDavRequest($user, "MKCOL", $destination, []); $this->response = $this->makeDavRequest($user, "MKCOL", $destination, []);
} catch (\GuzzleHttp\Exception\ServerException $e) { } 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(); $this->response = $e->getResponse();
} }
} }
@ -589,8 +601,12 @@ trait WebDav {
public function downloadingFileAs($fileName, $user) { public function downloadingFileAs($fileName, $user) {
try { try {
$this->response = $this->makeDavRequest($user, 'GET', $fileName, []); $this->response = $this->makeDavRequest($user, 'GET', $fileName, []);
} catch (\GuzzleHttp\Exception\ServerException $ex) { } catch (\GuzzleHttp\Exception\ServerException $e) {
$this->response = $ex->getResponse(); // 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();
} }
} }

Loading…
Cancel
Save