mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-26 06:46:08 +03:00
Merge branch 'nathanntg-master'
This commit is contained in:
commit
529e392386
@ -1,4 +1,25 @@
|
||||
<?php
|
||||
namespace Mailgun\Connection\Exceptions;
|
||||
|
||||
class GenericHTTPError extends \Exception{}
|
||||
class GenericHTTPError extends \Exception
|
||||
{
|
||||
protected $httpResponseCode;
|
||||
protected $httpResponseBody;
|
||||
|
||||
public function __construct($message=null, $response_code=null, $response_body=null, $code=0, \Exception $previous=null) {
|
||||
parent::__construct($message, $code, $previous);
|
||||
|
||||
$this->httpResponseCode = $response_code;
|
||||
$this->httpResponseBody = $response_body;
|
||||
}
|
||||
|
||||
public function getHttpResponseCode() {
|
||||
return $this->httpResponseCode;
|
||||
}
|
||||
|
||||
public function getHttpResponseBody() {
|
||||
return $this->httpResponseBody;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user