Comments (3)
There are a few options available.
Just catch the exception.
try
{
$response = $service->operation($request);
// Handle successful response.
}
catch(Exception $e)
{
/**
* Add strategy for dealing with the exception.
* For example log exception message or re-try request.
*/
}
You can also get access to the actual Guzzle3 object that sends the request. The httpClient method returns the HttpClient object that the SDK uses for sending the request. This object uses a Guzzle3 instance that can be obained via the guzzle method. This will enable you to use some of the Guzzle3 plugins that are available.
use GuzzleHttp\Subscriber\Retry\RetrySubscriber;
/**
* Use a plugin that retrys 500 and 503 responses.
*/
$retry = new RetrySubscriber([
'filter' => RetrySubscriber::createStatusFilter()
]);
$service = new Services\TradingService(...);
/**
* Attach pluging to Guzzle3 object.
*/
$service->httpClient()->guzzle()->getEmitter()->attach($retry);
$response = $service->operation($request);
It's also possible to supply the SDK with your own HTTP client and let that handle the actual request. You can then implement what ever retry mechanisam and error handling that you feel is suitable for your project. There is an example available that shows how to use cURL to send requests to the API.
from ebay-sdk-php.
Thank you for your detailed reply! (:
I had already tried to catch the exception globally, but that did not work.
I will try to solve it with Guzzle RetrySubscriber as you described.
from ebay-sdk-php.
Shame on me. I had just catched a CurlException, and no general Exception.. Sorry for the noise.
from ebay-sdk-php.
Related Issues (20)
- Return Policy Attribute Not Valid HOT 3
- SoldItemsOnly not working HOT 1
- Element names are incorrect in file HOT 2
- "invalid_client" on oAuth when requesting user access token HOT 7
- GetFeedbackRequest always returning the same date HOT 4
- The Feed API not Working HOT 3
- findItemAdvanced not return watchCount HOT 1
- Marketing resource url incorrect for BulkCreateAdsByListingId HOT 1
- Error 11 "Please specify a File with Valid Format" HOT 2
- Notifications HOT 2
- Finance API integration HOT 1
- Unable to search category by keywords HOT 1
- HTTPS everywhere? HOT 3
- Internal error to the application:10007 on GetOrders api HOT 1
- Credentials for findItemsIneBayStoresRequest HOT 3
- AddFixedPriceItemRequest and SuperSize photos HOT 1
- Is there a flag / option / etc to log the xml response from ebay? HOT 3
- Use this: Generate and Download API SDKs for eBay HOT 3
- DTS\eBaySDK\Trading\Types\AmountType value problem HOT 9
- "Warning: "continue" targeting switch is equivalent to "break". HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ebay-sdk-php.