From f2b0da4aea03b7d63442823c6fa66cd332e39d99 Mon Sep 17 00:00:00 2001 From: Hugo Bailey Date: Wed, 7 Sep 2016 19:17:22 +0200 Subject: [PATCH] Add missing parameters to error exception Closes #127 --- MangoPay/Libraries/Error.php | 21 +++++++++++++++++++++ MangoPay/Libraries/RestTool.php | 3 +++ 2 files changed, 24 insertions(+) diff --git a/MangoPay/Libraries/Error.php b/MangoPay/Libraries/Error.php index 5c6c7bfa..3a466463 100644 --- a/MangoPay/Libraries/Error.php +++ b/MangoPay/Libraries/Error.php @@ -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 diff --git a/MangoPay/Libraries/RestTool.php b/MangoPay/Libraries/RestTool.php index 70c3d1ae..3307687a 100644 --- a/MangoPay/Libraries/RestTool.php +++ b/MangoPay/Libraries/RestTool.php @@ -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);