Skip to content

Commit

Permalink
Don't catch the Guzzle Exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaschaaf committed Dec 8, 2015
1 parent 23c11ff commit 6a6f645
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions plivo.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,19 @@ private function request($method, $path, $params = array()) {

if (!strcmp($method, "POST")) {
$body = json_encode($params, JSON_FORCE_OBJECT);
try {
$response = $client->post('', array(

$response = $client->post('', array(
'headers' => [ 'Content-type' => 'application/json'],
'body' => $body,
));
} catch (ClientException $e) {
echo $e->getRequest();
echo $e->getResponse();
}
} else if (!strcmp($method, "GET")) {
try {
$response = $client->get('', array(
$response = $client->get('', array(
'query' => $params,
));
} catch (ClientException $e) {
echo $e->getRequest();
echo $e->getResponse();
}
} else if (!strcmp($method, "DELETE")) {
try {
$response = $client->delete('', array(
$response = $client->delete('', array(
'query' => $params,
));
} catch (ClientException $e) {
echo $e->getRequest();
echo $e->getResponse();
}
}
$responseData = json_decode($response->getBody(), true);
$status = $response->getStatusCode();
Expand Down

0 comments on commit 6a6f645

Please sign in to comment.