diff --git a/src/VendAPI/VendAPI.php b/src/VendAPI/VendAPI.php index cf1db24..98423cc 100644 --- a/src/VendAPI/VendAPI.php +++ b/src/VendAPI/VendAPI.php @@ -126,7 +126,7 @@ public function getRegisters($options = array()) return $this->apiGetRegisters($path); } - + /** * Get all sales * @@ -322,6 +322,10 @@ private function _request($path, $data = null, $depage = null) // Check for 400+ error: if($this->requestr->http_code >= 400) { + if($this->requestr->http_code == 400) { + // Error response from Vend, decode it and throw it + throw new Exception($result->error.'. '.$result->details); + } if($this->requestr->http_code == 429) { // Too Many Requests $retry_after = strtotime($result->{'retry-after'}); if($retry_after < time()) {