From: Mikael Nordfeldth Date: Sun, 7 Feb 2016 00:52:20 +0000 (+0100) Subject: NoHttpResponseException extends HTTP_Request2_ConnectionException X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=098c8b1df4c97cbc999bdf9ffea1823b35748436;p=quix0rs-gnu-social.git NoHttpResponseException extends HTTP_Request2_ConnectionException --- diff --git a/lib/httpclient.php b/lib/httpclient.php index 5c7850b260..ae2c7b0672 100644 --- a/lib/httpclient.php +++ b/lib/httpclient.php @@ -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(); diff --git a/lib/nohttpresponseexception.php b/lib/nohttpresponseexception.php index 1555fb96fc..e08921ef68 100644 --- a/lib/nohttpresponseexception.php +++ b/lib/nohttpresponseexception.php @@ -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); } } diff --git a/lib/queuemonitor.php b/lib/queuemonitor.php index cb68dee930..1790a5cd67 100644 --- a/lib/queuemonitor.php +++ b/lib/queuemonitor.php @@ -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"); } } diff --git a/plugins/OStatus/lib/discoveryhints.php b/plugins/OStatus/lib/discoveryhints.php index 5bd9fcbe48..86bd72f477 100644 --- a/plugins/OStatus/lib/discoveryhints.php +++ b/plugins/OStatus/lib/discoveryhints.php @@ -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; } diff --git a/plugins/OStatus/tests/slap.php b/plugins/OStatus/tests/slap.php index 84447bfd15..ba4af4e6a1 100755 --- a/plugins/OStatus/tests/slap.php +++ b/plugins/OStatus/tests/slap.php @@ -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(); } }