From 8df3db566a3a937b45ebf11adb90d265e6f5e2d4 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 17 Nov 2019 20:45:02 +0100 Subject: initial checking of customized version 1.0rc9 --- .../Guzzle/Http/Exception/BadResponseException.php | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php (limited to 'vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php') diff --git a/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php b/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php new file mode 100644 index 0000000..0ed0b47 --- /dev/null +++ b/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php @@ -0,0 +1,69 @@ +isClientError()) { + $label = 'Client error response'; + $class = __NAMESPACE__ . '\\ClientErrorResponseException'; + } elseif ($response->isServerError()) { + $label = 'Server error response'; + $class = __NAMESPACE__ . '\\ServerErrorResponseException'; + } else { + $label = 'Unsuccessful response'; + $class = __CLASS__; + } + + $message = $label . PHP_EOL . implode(PHP_EOL, array( + '[status code] ' . $response->getStatusCode(), + '[reason phrase] ' . $response->getReasonPhrase(), + '[url] ' . $request->getUrl(), + )); + + $e = new $class($message); + $e->setResponse($response); + $e->setRequest($request); + + return $e; + } + + /** + * Set the response that caused the exception + * + * @param Response $response Response to set + */ + public function setResponse(Response $response) + { + $this->response = $response; + } + + /** + * Get the response that caused the exception + * + * @return Response + */ + public function getResponse() + { + return $this->response; + } +} -- cgit v1.2.3-54-g00ecf