]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
NoHttpResponseException extends HTTP_Request2_ConnectionException
authorMikael Nordfeldth <mmn@hethane.se>
Sun, 7 Feb 2016 00:52:20 +0000 (01:52 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 7 Feb 2016 00:52:20 +0000 (01:52 +0100)
lib/httpclient.php
lib/nohttpresponseexception.php
lib/queuemonitor.php
plugins/OStatus/lib/discoveryhints.php
plugins/OStatus/tests/slap.php

index 5c7850b26032a66bcbe96740fa0a2197407e63af..ae2c7b067243c84ddcad9824e1909c7c0464b8a1 100644 (file)
@@ -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();
index 1555fb96fca5e74848a63c3186025cb6588d0575..e08921ef68b966ba0eb56e26c540fea71653ab91 100644 (file)
@@ -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);
     }
 }
index cb68dee930ce81f50fbe28bae7afebce4227c3f6..1790a5cd67585f82236ef10f12b587ac91a44542 100644 (file)
@@ -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");
         }
     }
 
index 5bd9fcbe4803a94d2646a2b3287ea8cfa87cfe35..86bd72f477909149556a3741899d144fea95b145 100644 (file)
@@ -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;
         }
 
index 84447bfd15b9c2797376ec46f2d61f2bbebcfe73..ba4af4e6a1e734d0859ffbedea0642a0d9189074 100755 (executable)
@@ -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();
     }
 }