Tim Starling has uploaded a new change for review.

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

Change subject: In parse.js specify a rejection handler
......................................................................

In parse.js specify a rejection handler

I haven't fully isolated the failure, but apparently due to a corner
case in Node or V8 (reproduced in both 0.10 and 0.12), the object passed
to the default catch handler is corrupted after it is rethrown, so an
exception thrown from e.g. ApiRequest just leads to "null" being printed
on the terminal, which is not very helpful. Specifying a rejection
handler in the final then() works around the issue.

Change-Id: I41658e7823392dc398e15a4e48d9e8a3b3ef9934
---
M tests/parse.js
1 file changed, 13 insertions(+), 6 deletions(-)


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

diff --git a/tests/parse.js b/tests/parse.js
index 401bc09..4706b6f 100755
--- a/tests/parse.js
+++ b/tests/parse.js
@@ -369,12 +369,19 @@
                parsoidConfig.defaultWiki = prefix ? prefix :
                        parsoidConfig.reverseMwApiMap.get(domain);
 
-               return parse(null, argv, parsoidConfig, prefix, 
domain).then(function(res) {
-                       var stdout = process.stdout;
-                       stdout.write(res.out);
-                       if (res.trailingNL && stdout.isTTY) {
-                               stdout.write('\n');
+               return parse(null, argv, parsoidConfig, prefix, domain).then(
+                       // Fulfilled
+                       function(res) {
+                               var stdout = process.stdout;
+                               stdout.write(res.out);
+                               if (res.trailingNL && stdout.isTTY) {
+                                       stdout.write('\n');
+                               }
+                       },
+                       // Rejected
+                       function(reason) {
+                               console.error("Parse failed with reason: ", 
reason);
                        }
-               }).done();
+               ).done();
        }());
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I41658e7823392dc398e15a4e48d9e8a3b3ef9934
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <[email protected]>

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

Reply via email to