Skip to content

Commit

Permalink
Add missing parameters to error exception
Browse files Browse the repository at this point in the history
Closes #127
  • Loading branch information
Hugo Bailey committed Sep 7, 2016
1 parent 07b280a commit f2b0da4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions MangoPay/Libraries/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,27 @@ class Error
* @access public
*/
public $Errors;

/**
* An identifer for this API response
* @var string
* @access public
*/
public $Id;

/**
* The timestamp of this API response
* @var timestamp
* @access public
*/
public $Date;

/**
* The type of error
* @var string
* @access public
*/
public $Type;

/**
* Return the stdClass error serialized as string
Expand Down
3 changes: 3 additions & 0 deletions MangoPay/Libraries/RestTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ private function CheckResponseCode($response)
$error->Errors = property_exists($response, 'Errors')
? $response->Errors
: property_exists($response, 'errors') ? $response->errors : null;
$error->Id = property_exists($response, 'Id') ? $response->Id : null;
$error->Type = property_exists($response, 'Type') ? $response->Type : null;
$error->Date = property_exists($response, 'Date') ? $response->Date : null;
throw new ResponseException($this->_requestUrl, $this->_responseCode, $error);
} else {
throw new ResponseException($this->_requestUrl, $this->_responseCode);
Expand Down

0 comments on commit f2b0da4

Please sign in to comment.