HTTPClient would return null instead of exception
This caused $response->isOK() tests to call a function on a non-existing object, causing all hell to break loose.
This commit is contained in:
@@ -96,11 +96,14 @@ class QueueMonitor
|
||||
protected function pingHttp($target, $data)
|
||||
{
|
||||
$client = new HTTPClient();
|
||||
$result = $client->post($target, array(), $data);
|
||||
try {
|
||||
$result = $client->post($target, array(), $data);
|
||||
|
||||
if (!$result->isOk()) {
|
||||
common_log(LOG_ERR, __METHOD__ . ' HTTP ' . $result->getStatus() .
|
||||
': ' . $result->getBody());
|
||||
if (!$result->isOk()) {
|
||||
common_log(LOG_ERR, __METHOD__ . ' HTTP ' . $result->getStatus() . ': ' . $result->getBody());
|
||||
}
|
||||
} catch (HTTP_Request2_Exception $e) {
|
||||
common_log(LOG_ERR, __METHOD__ . ' HTTP request generated PHP level error (check logs, could be DNS failure etc.). URL: '.var_export($target,true));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user