summaryrefslogtreecommitdiff
path: root/inc/mailgun/php-http/httplug/src/Exception/RequestException.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/mailgun/php-http/httplug/src/Exception/RequestException.php')
-rw-r--r--inc/mailgun/php-http/httplug/src/Exception/RequestException.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/inc/mailgun/php-http/httplug/src/Exception/RequestException.php b/inc/mailgun/php-http/httplug/src/Exception/RequestException.php
new file mode 100644
index 0000000..cdce14b
--- /dev/null
+++ b/inc/mailgun/php-http/httplug/src/Exception/RequestException.php
@@ -0,0 +1,43 @@
+<?php
+
+namespace Http\Client\Exception;
+
+use Psr\Http\Message\RequestInterface;
+
+/**
+ * Exception for when a request failed, providing access to the failed request.
+ *
+ * This could be due to an invalid request, or one of the extending exceptions
+ * for network errors or HTTP error responses.
+ *
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
+ */
+class RequestException extends TransferException
+{
+ /**
+ * @var RequestInterface
+ */
+ private $request;
+
+ /**
+ * @param string $message
+ * @param RequestInterface $request
+ * @param \Exception|null $previous
+ */
+ public function __construct($message, RequestInterface $request, \Exception $previous = null)
+ {
+ $this->request = $request;
+
+ parent::__construct($message, 0, $previous);
+ }
+
+ /**
+ * Returns the request.
+ *
+ * @return RequestInterface
+ */
+ public function getRequest()
+ {
+ return $this->request;
+ }
+}