Page MenuHomePhabricator

Add meaningful error messages to the console when Wikipedia Preview shows the error state
Closed, ResolvedPublic

Description

Wikipedia Preview displays an error state when a page is not supported (Main_page), it doesn't exist, or there's an unexpected error from the API. In all cases the error message is generic and there's nothing the reader can do about it anyway.

While the error is unhelpful we don't plan to remove the error state just yet because 1) is it preceded by the loading state and 2) we're taking steps to greatly reduce the number of errors (supporting other namespaces, plugin won't let you use invalid configuration).

We want editors/integrators to be able to troubleshoot errors caused by invalid configuration. We'll add specific console.error messages for all the cases we can find.

Here's a non-exhaustive list

  • The specified article doesn't exist
  • The article exists but the API returns no summary (type: "no-extract")
  • xhr-level exception

Event Timeline

SBisson renamed this task from Consider replacing the error state with a javascript console message to Replacing the error state with a javascript console message.Aug 9 2021, 1:57 PM
SBisson triaged this task as Medium priority.
SBisson edited projects, added Inuka-Team (Kanban); removed Inuka-Team.
SBisson updated the task description. (Show Details)
SBisson renamed this task from Replacing the error state with a javascript console message to Replace the error state with a javascript console message.Aug 9 2021, 5:57 PM

@AMuigai @SGautam_WMF @hueitan @eamedina

Wondering what to do with the loading state if we remove the error state. When we show the loading state, we don't know yet if there is going to be an issue. I see a few solution but I don't know if any of them is good:

  1. Show the loading state briefly until the API response arrives then hide everything if there's an error. To avoid the big flash of the loading state we could use cursor: progress to indicate that something is going on.
  2. Get rid of the loading state and only show a preview when we know for sure that the preview is valid. The risk here is that users don't wait long enough on target elements to actually see the preview.
SBisson renamed this task from Replace the error state with a javascript console message to Add meaningful error messages to the console when Wikipedia Preview shows the error state.Aug 19 2021, 5:32 PM
SBisson updated the task description. (Show Details)

For the loading state, I like showing something simple what about the one we are using for the loading state inside gallery.

We want editors/integrators to be able to troubleshoot errors caused by invalid configuration. We'll add specific console.error messages for all the cases we can find.

Is the idea here to use the browser inspect mode to check the console panel? If so, I think it would be helpful for folks who have some technical knowledge though I guess we would still need to add it somewhere on the plugin page, maybe screenshots or FAQ. Shall we also add some helpful tips on error state for folks who won't be using the console panel?

The PR is merged.

I tested this by using invalid and unsupported page titles in the storybook.

Jpita added a subscriber: Jpita.

discussion happening on github

Is there any pending question? From what you are describing in github, it looks like it is working as expected even though the preview is not always helpful.