git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 098c8b1d authored by mmn's avatar mmn

NoHttpResponseException extends HTTP_Request2_ConnectionException

parent 55546a5a
......@@ -355,8 +355,6 @@ class HTTPClient extends HTTP_Request2
continue;
} catch (HTTP_Request2_Exception $e) {
common_log(LOG_ERR, __CLASS__ . ": Invalid $code redirect from $url to $target");
} catch (NoHttpResponseException $e) {
common_log(LOG_ERR, __CLASS__ . ": {$e->getMessage()}");
}
} else {
$reason = $response->getReasonPhrase();
......
......@@ -30,7 +30,7 @@
if (!defined('GNUSOCIAL')) { exit(1); }
// Can't extend HTTP_Request2_Exception since it requires an HTTP status code which we didn't get
class NoHttpResponseException extends Exception
class NoHttpResponseException extends HTTP_Request2_ConnectionException
{
public $url; // target URL
......@@ -38,6 +38,6 @@ class NoHttpResponseException extends Exception
{
$this->url = $url;
// We could log an entry here with the search parameters
parent::__construct(sprintf(_('No HTTP response from URL %s.'), _ve($url)));
parent::__construct(sprintf(_('No HTTP response from URL %s.'), _ve($url)), self::READ_ERROR);
}
}
......@@ -104,6 +104,8 @@ class QueueMonitor
}
} catch (NoHttpResponseException $e) {
common_log(LOG_ERR, __METHOD__ . ':'.$e->getMessage());
} catch (HTTP_Request2_Exception $e) {
common_log(LOG_ERR, __CLASS__ . ": Invalid $code redirect from $url to $target");
}
}
......
......@@ -64,8 +64,9 @@ class DiscoveryHints {
if (!$response->isOk()) {
return null;
}
} catch (NoHttpResponseException $e) {
} catch (HTTP_Request2_Exception $e) {
// Any HTTPClient error that might've been thrown
common_log(LOG_ERR, __METHOD__ . ':'.$e->getMessage());
return null;
}
......
......@@ -80,7 +80,7 @@ if (have_option('--verify')) {
print $response->getStatus() . "\n\n";
print $response->getBody() . "\n\n";
} catch (NoHttpResponseException $e) {
} catch (HTTP_Request2_Exception $e) {
print 'Failed POST to URL '.var_export($url, true).': '.$e->getMessage();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment