Last modified: 2014-11-19 02:04:24 UTC
Image patch (https://gerrit.wikimedia.org/r/#/c/57817/) is missing error handling when the mw API is queried to get information about an image. Two kind of errors that handleResponse in LinkHandler.js has to deal with: (1) API error: Given that ApiRequest retries, an api error is an indication that the api may be temporarily down or that something else is wrong. So, rather than continue, it is better to abort processing and return an error code to the clients so they can handle it however they want (ex: ve might tell the user that the page cannot be edited right now because of api/server issues). This will require calling the error callback found in env. (2) Image missing: If the api comes back and tells us that the image is missing, we should handle this similar to how the PHP parser does it for missing images. - Maybe link to a special page/url that will let VE present an upload handler (check with VE folks as to what this url could be. PHP parser behavior can be found by editing a page on wikipedia sandbox with a non-existent image) - Dont add a thumb. - Add a special rdf type on the image/wrapper tag: mw:Image/Missing maybe?
Before merging Mark's image patch I added very basic error handling that at least round-trips the image in case something goes wrong. This uses a simple mw:Placeholder for now, but we should probably create a generic error RDFa type that lets us report localizable errors while still ensuring round-tripping. To let editors fix such an issue it might be useful to attach the regular DOM structure to the error wrapper. We'd also need to point out which property needs to be fixed, so that a client like the VisualEditor can provide a useful dialog.
*** Bug 50035 has been marked as a duplicate of this bug. ***
[Parsoid component reorg by merging JS/General and General. See bug 50685 for more information. Filter bugmail on this comment. parsoidreorg20130704]
*** Bug 51039 has been marked as a duplicate of this bug. ***
*** Bug 51244 has been marked as a duplicate of this bug. ***
Another example from bug 51244 - http://parsoid.wmflabs.org/pt/Usu%C3%A1rio:Helder.wiki/Testes?oldid=36380720
*** Bug 50290 has been marked as a duplicate of this bug. ***
*** Bug 51535 has been marked as a duplicate of this bug. ***
We recently discussed this again. A possible solution might be to mark arbitrary elements as error-affected using an additional mw:Error typeof (or CSS class), plus error information in data-mw.error. This error information can be an object like this: { key: "missing-image", msg: "This image did not exist" } The key can be used to retrieve localized messages. The msg just provides a non-localized fall-back. We could leave that out too if we are concerned about space. For images, we'd use the standard DOM structure as if the image existed, but point out the error with the typeof and data-mw so that the VE can help the user to fix the issue. Similarly, bots can look for errors and potentially fix them automatically.
Spec in development at http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Error_handling
*** Bug 51615 has been marked as a duplicate of this bug. ***
We should tackle this one soon since this blocks Flow from removing data-parsoid from their code. They use data-parsoid for missing images to render links. We currently emit a mw:Placeholder meta for it.
Change 170455 had a related patch set uploaded by Subramanya Sastry: WIP: (Bug 48900) Add mw:Error + error info to data-mw for missing imgs https://gerrit.wikimedia.org/r/170455