Cscott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/301490

Change subject: Better logging for empty JSON replies.
......................................................................

Better logging for empty JSON replies.

Suggested by T141391.

Change-Id: I3f9d6f7c93b60ea51c6a277d42d58bd5fc3e379f
---
M lib/mw/ApiRequest.js
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/90/301490/1

diff --git a/lib/mw/ApiRequest.js b/lib/mw/ApiRequest.js
index 3faf2de..3eb9c53 100644
--- a/lib/mw/ApiRequest.js
+++ b/lib/mw/ApiRequest.js
@@ -454,8 +454,16 @@
                }
                data = JSON.parse(body);
        } catch (e) {
-               error = new ParserError('Failed to parse the JSON response for 
' +
+               if (!body) {
+                       // This is usually due to a fatal error on the PHP 
side, although
+                       // it would be nice (!) if PHP would return a non-200 
error code
+                       // for this!
+                       error = new ParserError('Empty JSON response returned 
for ' +
                                this.reqType);
+               } else {
+                       error = new ParserError('Failed to parse the JSON 
response for ' +
+                               this.reqType);
+               }
        }
        this._handleJSON(error, data);
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f9d6f7c93b60ea51c6a277d42d58bd5fc3e379f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <canan...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to