Add LimitException (#61)
Add LimitException class to determine if the query limit is exceeded
This commit is contained in:
parent
5d1760c245
commit
1826dd57d6
30
lib/RetailCrm/Exception/LimitException.php
Normal file
30
lib/RetailCrm/Exception/LimitException.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 5.4
|
||||||
|
*
|
||||||
|
* Class LimitException
|
||||||
|
*
|
||||||
|
* @category RetailCrm
|
||||||
|
* @package RetailCrm
|
||||||
|
* @author RetailCrm <integration@retailcrm.ru>
|
||||||
|
* @license https://opensource.org/licenses/MIT MIT License
|
||||||
|
* @link http://www.retailcrm.ru/docs/Developers/ApiVersion5
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 5.4
|
||||||
|
*
|
||||||
|
* Class LimitException
|
||||||
|
*
|
||||||
|
* @category RetailCrm
|
||||||
|
* @package RetailCrm
|
||||||
|
* @author RetailCrm <integration@retailcrm.ru>
|
||||||
|
* @license https://opensource.org/licenses/MIT MIT License
|
||||||
|
* @link http://www.retailcrm.ru/docs/Developers/ApiVersion5
|
||||||
|
*/
|
||||||
|
class LimitException extends \DomainException
|
||||||
|
{
|
||||||
|
}
|
@ -16,6 +16,7 @@ namespace RetailCrm\Http;
|
|||||||
|
|
||||||
use RetailCrm\Exception\CurlException;
|
use RetailCrm\Exception\CurlException;
|
||||||
use RetailCrm\Exception\InvalidJsonException;
|
use RetailCrm\Exception\InvalidJsonException;
|
||||||
|
use RetailCrm\Exception\LimitException;
|
||||||
use RetailCrm\Response\ApiResponse;
|
use RetailCrm\Response\ApiResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -116,6 +117,11 @@ class Client
|
|||||||
|
|
||||||
$responseBody = curl_exec($curlHandler);
|
$responseBody = curl_exec($curlHandler);
|
||||||
$statusCode = curl_getinfo($curlHandler, CURLINFO_HTTP_CODE);
|
$statusCode = curl_getinfo($curlHandler, CURLINFO_HTTP_CODE);
|
||||||
|
|
||||||
|
if ($statusCode == 503) {
|
||||||
|
throw new LimitException("Service temporary unavalable");
|
||||||
|
}
|
||||||
|
|
||||||
$errno = curl_errno($curlHandler);
|
$errno = curl_errno($curlHandler);
|
||||||
$error = curl_error($curlHandler);
|
$error = curl_error($curlHandler);
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ class ApiClientCustomersTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testCustomersNotesDelete()
|
public function testCustomersNotesDelete()
|
||||||
{
|
{
|
||||||
self::markTestSkipped('Sould be fixed.');
|
self::markTestSkipped('Should be fixed.');
|
||||||
|
|
||||||
$client = static::getApiClient();
|
$client = static::getApiClient();
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class ApiClientDeliveryTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDeliveryShipments()
|
public function testDeliveryShipments()
|
||||||
{
|
{
|
||||||
self::markTestSkipped('Sould be fixed.');
|
self::markTestSkipped('Should be fixed.');
|
||||||
|
|
||||||
$client = static::getApiClient();
|
$client = static::getApiClient();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user