Page MenuHomePhabricator

Mark up http errors + missing TEMPLATE errors with generic error attributes + error info in data-mw
Closed, ResolvedPublic

Description

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?

EDIT: These properties should apply to missing templates as well.


Version: unspecified
Severity: normal

Details

Reference
bz48900

Event Timeline

bzimport raised the priority of this task from to Unbreak Now!.Nov 22 2014, 1:37 AM
bzimport added a project: Parsoid.
bzimport set Reference to bz48900.

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. ***
  • 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.

  • 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

ssastry lowered the priority of this task from Unbreak Now! to High.Dec 2 2014, 9:48 AM
ssastry set Security to None.

Change 170455 had a related patch set uploaded (by Subramanya Sastry):
T50900: Add mw:Error error info to data-mw for missing imgs

https://gerrit.wikimedia.org/r/170455

Patch-For-Review

Change 170455 merged by jenkins-bot:
T50900: Add mw:Error error info to data-mw for missing imgs

https://gerrit.wikimedia.org/r/170455

This has been deployed.

According to comments in ext.core.TemplateHandler.js, the data-mw update was supposed to apply to missing templates as well. Re-opening and retitling to reflect work remaining, since there are already references in the source code to this bug #.

cscott renamed this task from Mark up http errors + missing image errors with generic error attributes + error info in data-mw to Mark up http errors + missing TEMPLATE errors with generic error attributes + error info in data-mw.Aug 17 2015, 5:18 PM
cscott updated the task description. (Show Details)
ssastry lowered the priority of this task from High to Medium.Jul 15 2016, 9:49 PM
ssastry removed a project: Patch-For-Review.

Change 339689 had a related patch set uploaded (by Arlolra):
T50900: Set mw:Error and provide error info in data-mw for ext/tpl

https://gerrit.wikimedia.org/r/339689

Change 339689 merged by jenkins-bot:
T50900: Set mw:Error and provide error info in data-mw for ext/tpl

https://gerrit.wikimedia.org/r/339689