@@ -393,7 +393,7 @@ public function decodeSingle(&$apiData)
393
393
if (isset ($ resObj ->error ->errors [0 ])) {
394
394
$ msg .= " : " . $ resObj ->error ->errors [0 ]->reason ;
395
395
}
396
- throw new \Exception ($ msg );
396
+ throw new \Exception ($ msg, $ resObj -> error -> code );
397
397
} else {
398
398
$ itemsArray = $ resObj ->items ;
399
399
if (!is_array ($ itemsArray ) || count ($ itemsArray ) == 0 ) {
@@ -419,7 +419,7 @@ public function decodeList(&$apiData)
419
419
if (isset ($ resObj ->error ->errors [0 ])) {
420
420
$ msg .= " : " . $ resObj ->error ->errors [0 ]->reason ;
421
421
}
422
- throw new \Exception ($ msg );
422
+ throw new \Exception ($ msg, $ resObj -> error -> code );
423
423
} else {
424
424
$ this ->page_info = array (
425
425
'resultsPerPage ' => $ resObj ->pageInfo ->resultsPerPage ,
@@ -472,7 +472,7 @@ public function api_get($url, $params)
472
472
curl_setopt ($ tuCurl , CURLOPT_RETURNTRANSFER , 1 );
473
473
$ tuData = curl_exec ($ tuCurl );
474
474
if (curl_errno ($ tuCurl )) {
475
- throw new \Exception ('Curl Error : ' . curl_error ($ tuCurl ));
475
+ throw new \Exception ('Curl Error : ' . curl_error ($ tuCurl ), curl_error ( $ tuCurl ) );
476
476
}
477
477
return $ tuData ;
478
478
}
0 commit comments