jenkins-bot has submitted this change and it was merged.

Change subject: Improve error message for non-success HTTP response
......................................................................


Improve error message for non-success HTTP response

Bug: T116349
Change-Id: I3fd219781b0e80dc2a8b870b847f9a2c30f42269
---
M src/Client.php
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  CSteipp: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/Client.php b/src/Client.php
index f8423d7..39d13d0 100644
--- a/src/Client.php
+++ b/src/Client.php
@@ -263,7 +263,12 @@
                }
                $data = curl_exec( $ch );
                if ( !$data ) {
-                       throw new Exception( 'Curl error: ' . curl_error( $ch ) 
);
+                       if ( curl_errno( $ch ) ) {
+                               throw new Exception( 'Curl error: ' . 
curl_error( $ch ) );
+                       } else {
+                               throw new Exception( 'Empty HTTP response! 
Status: '
+                                       . curl_getinfo( $ch, CURLINFO_HTTP_CODE 
) );
+                       }
                }
                return $data;
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/248586
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3fd219781b0e80dc2a8b870b847f9a2c30f42269
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/oauthclient-php
Gerrit-Branch: master
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: CSteipp <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to