I have been trying to use the batch feature to download a number of image resources. I need to understand which requests have had a good response (so that they can be processed further) and which have failed (for error logging).
I have read extensively on guide (Though rather slim on detail):
Plus forums:
This solution looks interesting but uses SendAll() which i have seen no reference to in Guzzle 4 docs?
The functions getSuccessful() and getFailures() look interesting but provide no way to identify which request each response is from
If i use the following on a bad result:
try{
$result2 = $results->getResult($requests[1]);
echo "Result2: " . $result2->getStatusCode();
} catch(Exception $e){
if($e->getMessage()){
$error = $e->getMessage();
} else {
$error = 'Generic exception caught';
}
echo "Error: $error";
}
I get an error that isnt caught, plus the above doesnt feel like a good way to manage the success/fail process.
Is there a recommended pattern for this?
Matt