Improve error message for failing HTTP requests
authorphysikerwelt <wiki@physikerwelt.de>
Sat, 21 Nov 2015 17:05:17 +0000 (18:05 +0100)
committerPhysikerwelt <wiki@physikerwelt.de>
Sat, 21 Nov 2015 17:17:17 +0000 (17:17 +0000)
Before this change, the information that is written
to the log for requests with a non 200 return status
is not very helpful. A variable $errors is created,
but never used.

This patch writes the $errors and the request body
to the log.

Change-Id: If62ec801d59b2343890f4238e5a534d034d934ad

includes/HttpFunctions.php

index 60196ab..e6801e3 100644 (file)
@@ -80,7 +80,8 @@ class Http {
                } else {
                        $errors = $status->getErrorsByType( 'error' );
                        $logger = LoggerFactory::getInstance( 'http' );
-                       $logger->warning( $status->getWikiText(), array( 'caller' => $caller ) );
+                       $logger->warning( $status->getWikiText(),
+                               array( 'error' => $errors, 'caller' => $caller, 'content' => $req->getContent() ) );
                        return false;
                }
        }