Open santhoshtr opened 6 years ago
In Parsoid we use a wrapper for these cases:
try {
return Title.newFromText(...args);
} catch (e) {
return null;
}
This is a little more robust if you assert that the caught error is instanceof TitleError
(see PR #42).
The mw.Title in mediawiki core has the following behavior for invalid titles:
Use #newFromText to use the logic directly and get null for invalid titles which is easier to work with.
But this library throws errors for invalid characters. Would it be a nice idea to make the behavior consistent with mediawiki core?