Skip to content

Commit

Permalink
Merge pull request #7 from Crowdcube/catch_400_errors
Browse files Browse the repository at this point in the history
suppressing 400 errors
  • Loading branch information
greydnls committed Sep 24, 2015
2 parents c6ac792 + 2f02f1e commit 1c0bebd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Message/CompletePurchaseRequest.php
Expand Up @@ -31,6 +31,16 @@ public function getData()

public function sendData($data)
{
// don't throw exceptions for 4xx errors
$this->httpClient->getEventDispatcher()->addListener(
'request.error',
function ($event) {
if ($event['response']->isClientError()) {
$event->stopPropagation();
}
}
);

$httpRequest = $this->httpClient->post(
$this->getEndpoint().'/api/v1/confirm',
array('Accept' => 'application/json'),
Expand Down

0 comments on commit 1c0bebd

Please sign in to comment.