1
0
mirror of synced 2024-11-24 22:36:06 +03:00

Add LimitException (#61)

Add LimitException class to determine if the query limit is exceeded
This commit is contained in:
Alex Lushpai 2018-02-27 12:00:09 +03:00 committed by GitHub
parent 5d1760c245
commit 1826dd57d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 2 deletions

View 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
{
}

View File

@ -16,6 +16,7 @@ namespace RetailCrm\Http;
use RetailCrm\Exception\CurlException;
use RetailCrm\Exception\InvalidJsonException;
use RetailCrm\Exception\LimitException;
use RetailCrm\Response\ApiResponse;
/**
@ -116,6 +117,11 @@ class Client
$responseBody = curl_exec($curlHandler);
$statusCode = curl_getinfo($curlHandler, CURLINFO_HTTP_CODE);
if ($statusCode == 503) {
throw new LimitException("Service temporary unavalable");
}
$errno = curl_errno($curlHandler);
$error = curl_error($curlHandler);

View File

@ -407,7 +407,7 @@ class ApiClientCustomersTest extends TestCase
*/
public function testCustomersNotesDelete()
{
self::markTestSkipped('Sould be fixed.');
self::markTestSkipped('Should be fixed.');
$client = static::getApiClient();

View File

@ -55,7 +55,7 @@ class ApiClientDeliveryTest extends TestCase
*/
public function testDeliveryShipments()
{
self::markTestSkipped('Sould be fixed.');
self::markTestSkipped('Should be fixed.');
$client = static::getApiClient();