Matthias Mullie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/169710
Change subject: Throw correct exception when failing to contact Parsoid
......................................................................
Throw correct exception when failing to contact Parsoid
This will allow us to fall back to regular parser.
Change-Id: I57b7006560c3cbd50d4cdf7e0ffb8a5790539939
---
M autoload.php
M includes/Exception/ExceptionHandling.php
M includes/Parsoid/Utils.php
3 files changed, 13 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/10/169710/1
diff --git a/autoload.php b/autoload.php
index 891d85d..7909ed4 100644
--- a/autoload.php
+++ b/autoload.php
@@ -127,6 +127,7 @@
$wgAutoloadClasses['Flow\\Exception\\InvalidDataException'] = __DIR__ .
'/includes/Exception/ExceptionHandling.php';
$wgAutoloadClasses['Flow\\Exception\\InvalidInputException'] = __DIR__ .
'/includes/Exception/ExceptionHandling.php';
$wgAutoloadClasses['Flow\\Exception\\NoIndexException'] = __DIR__ .
'/includes/Exception/ExceptionHandling.php';
+$wgAutoloadClasses['Flow\\Exception\\NoParsoidException'] = __DIR__ .
'/includes/Exception/ExceptionHandling.php';
$wgAutoloadClasses['Flow\\Exception\\PermissionException'] = __DIR__ .
'/includes/Exception/ExceptionHandling.php';
$wgAutoloadClasses['Flow\\Exception\\WikitextException'] = __DIR__ .
'/includes/Exception/ExceptionHandling.php';
$wgAutoloadClasses['Flow\\Exception\\WrongNumberArgumentsException'] = __DIR__
. '/includes/Exception/ExceptionHandling.php';
diff --git a/includes/Exception/ExceptionHandling.php
b/includes/Exception/ExceptionHandling.php
index 38faa98..63fcf14 100644
--- a/includes/Exception/ExceptionHandling.php
+++ b/includes/Exception/ExceptionHandling.php
@@ -263,6 +263,15 @@
}
/**
+ * Category: Parsoid
+ */
+class NoParsoidException extends FlowException {
+ protected function getErrorCodeList() {
+ return array ( 'process-wikitext' );
+ }
+}
+
+/**
* Category: wikitext/html conversion exception
*/
class WikitextException extends FlowException {
diff --git a/includes/Parsoid/Utils.php b/includes/Parsoid/Utils.php
index b36235b..37cc5ff 100644
--- a/includes/Parsoid/Utils.php
+++ b/includes/Parsoid/Utils.php
@@ -4,6 +4,7 @@
use DOMDocument;
use DOMNode;
+use Flow\Exception\NoParsoidException;
use Language;
use OutputPage;
use Title;
@@ -78,7 +79,7 @@
protected static function parsoid( $from, $to, $content, Title $title )
{
list( $parsoidURL, $parsoidPrefix, $parsoidTimeout ) =
self::parsoidConfig();
if ( !isset( $parsoidURL ) || !$parsoidURL ) {
- throw new NoParsoidException( 'Flow Parsoid
configuration is unavailable' );
+ throw new NoParsoidException( 'Flow Parsoid
configuration is unavailable', 'process-wikitext' );
}
if ( $from == 'html' ) {
@@ -102,7 +103,7 @@
$status = $request->execute();
if ( !$status->isOK() ) {
wfDebugLog( 'Flow', __METHOD__ . ': Failed contacting
parsoid: ' . $status->getMessage()->text() );
- throw new WikitextException( 'Failed contacting
Parsoid', 'process-wikitext' );
+ throw new NoParsoidException( 'Failed contacting
Parsoid', 'process-wikitext' );
}
$response = $request->getContent();
@@ -288,5 +289,3 @@
return Title::newFromText( $text );
}
}
-
-class NoParsoidException extends \MWException {}
--
To view, visit https://gerrit.wikimedia.org/r/169710
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I57b7006560c3cbd50d4cdf7e0ffb8a5790539939
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits