Skip to content

Commit

Permalink
Update to extract content from body
Browse files Browse the repository at this point in the history
  • Loading branch information
bakura10 committed Dec 27, 2013
1 parent 29dde1f commit 6401c7b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ZfrMailChimp/Client/Listener/ErrorHandlerListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,13 @@ public static function getSubscribedEvents()
*/
public function handleError(Event $event)
{
/* @var \Guzzle\Service\Command\CommandInterface $command */
$command = $event['command'];
$response = $command->getResponse();

$response = $event['response'];

if ($response->getStatusCode() === 200) {
return;
}

$result = $command->toArray();
$result = json_decode($response->getBody(), true);
$errorName = isset($result['name']) ? $result['name'] : 'Unknown_Exception';

throw new $this->errorMap[$errorName]($result['error'], $result['code']);
Expand Down

0 comments on commit 6401c7b

Please sign in to comment.