Skip to content

Commit

Permalink
Merge pull request #83 from jbutkus/curl_exception
Browse files Browse the repository at this point in the history
Just one type of exception provides response object.
  • Loading branch information
mikevanwinkle committed Feb 11, 2015
2 parents 781d786 + 4106f74 commit 43d02cf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion php/class-terminus-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,14 @@ public static function request($realm, $uuid, $path = FALSE, $method = 'GET', $o
);
$cache->put_data($cachekey, $data);
return $data;
} catch( Exception $e ) {
} catch( Guzzle\Http\Exception\BadResponseException $e ) {
$response = $e->getResponse();
\Terminus::error("%s", $response->getBody(TRUE) );
} catch( Guzzle\Http\Exception\HttpException $e ) {
$request = $e->getRequest();
\Terminus::error("Request %s had failed: %s", (string)$request, $e->getMessage() );
} catch( Exception $e ) {
\Terminus::error("Unrecognised request failure: %s", $e->getMessage() );
}

}
Expand Down

0 comments on commit 43d02cf

Please sign in to comment.