Page MenuHomePhabricator

VisualEditor: Handle Parsoid error messages and codes sanely
Closed, ResolvedPublic

Description

VE gets some error codes and messages from Parsoid, but not a lot. I'm expanding that a little bit in a new patch [0], and it would be cool if VE could handle the errors I've added.

401: Unauthorized: Should be handled as a user-visible error. Usually this means that the API isn't readable by anonymous users, but could be later used for something else. The text of the HTTP response has details about the error, so showing that to the user might be an OK solution.

404: Not found: Usually means that we couldn't find anything for the article you're trying to parse or serialize. This shouldn't usually happen, but when it does, it *probably* means that the interwiki isn't set properly. Maybe hint that the user should compare their localsettings.js file to the example.

500: Server error: This is a catch-all, but we'll send as much information as we can in the text of the HTTP response. Showing the user the text would go a long way towards more useful bug reports (I currently see roughly 4 suggested duplicates that have roughly the same summary....differentiating them might be helpful)

These are all implemented in js/lib/mediawiki.ApiRequest.js in functions that inherit from the native Error object, so you can read it if you don't want to take my word for it.

We could implement other error codes as we see cases that require them, but these are the big three. And of course 200 is the main success code.

We might also be able to use some of the 3xx codes to represent redirects, but I'm not sure it would be totally useful. File a bug against Parsoid if it would be :)

[0] https://gerrit.wikimedia.org/r/45794


Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=43147

Details

Reference
bz44354

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:40 AM
bzimport set Reference to bz44354.

Code in gerrit 52249

(In reply to comment #1)

Code in Gerrit change #52249

This patch passes through the error messages from Parsoid to the existing error alert in VE. Mark's comment talks about providing suggestions based on the error code. Although maybe this could be done by Parsoid.

This change should at least provide users with more specific errors for filing bugs.

Marking this as done as the code's been committed; we may want to review in future (e.g. i18n of the error messages), but Gabriel has indicated that that entire area of code will be removed anyway, so marking as closed for now.