Merge "WikiImporter: Improve error message output"

This commit is contained in:
jenkins-bot 2023-07-10 15:07:26 +00:00 committed by Gerrit Code Review
commit ea682628e3
2 changed files with 4 additions and 3 deletions

View file

@ -709,8 +709,9 @@ class WikiImporter {
'message' => $error->message,
] );
} else {
throw new MWException( "Expected <mediawiki> tag, got " .
$this->reader->localName );
throw new MWException(
"Expected '<mediawiki>' tag, got '<{$this->reader->localName}>' tag."
);
}
}
$this->debug( "<mediawiki> tag is correct." );

View file

@ -88,7 +88,7 @@ class ImportFailureTest extends MediaWikiLangTestCase {
public static function provideImportFailure() {
yield [ 'BadXML', MWException::class, '/^XML error at line 3: Opening and ending tag mismatch:.*$/' ];
yield [ 'MissingMediaWikiTag', MWException::class, '/^Expected <mediawiki> tag, got .*$/' ];
yield [ 'MissingMediaWikiTag', MWException::class, "/^Expected '<mediawiki>' tag, got .*$/" ];
yield [ 'MissingMainTextField', MWException::class, '/^Missing text field in import.$/' ];
yield [ 'MissingSlotTextField', MWException::class, '/^Missing text field in import.$/' ];
yield [ 'MissingSlotRole', MWException::class, '/^Missing role for imported slot.$/' ];