diff --git a/src/Mailgun/Connection/Exceptions/GenericHTTPError.php b/src/Mailgun/Connection/Exceptions/GenericHTTPError.php index bcbb61d..b370649 100644 --- a/src/Mailgun/Connection/Exceptions/GenericHTTPError.php +++ b/src/Mailgun/Connection/Exceptions/GenericHTTPError.php @@ -1,4 +1,25 @@ httpResponseCode = $response_code; + $this->httpResponseBody = $response_body; + } + + public function getHttpResponseCode() { + return $this->httpResponseCode; + } + + public function getHttpResponseBody() { + return $this->httpResponseBody; + } +} + +?> diff --git a/src/Mailgun/Connection/RestClient.php b/src/Mailgun/Connection/RestClient.php index e68cdf3..54d3a25 100644 --- a/src/Mailgun/Connection/RestClient.php +++ b/src/Mailgun/Connection/RestClient.php @@ -131,7 +131,7 @@ class RestClient{ throw new MissingEndpoint(EXCEPTION_MISSING_ENDPOINT); } else{ - throw new GenericHTTPError(EXCEPTION_GENERIC_HTTP_ERROR); + throw new GenericHTTPError(EXCEPTION_GENERIC_HTTP_ERROR, $httpResponseCode, $responseObj->getBody()); } $result->http_response_code = $httpResponseCode; return $result;