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