Lexeme header widget should handle API errors
Closed, ResolvedPublic2 Story Points

Description

Lexeme header makes calls to the API while saving changes made by the user. In case some error happens (e.g. invalid data has been provided), the API returns the error response. Currently, the widget silently ignores the errors. It switches to non-edit mode and looks like the changes have been saved. In fact, those changes have not been saved, as reloading the page proves. Not saving invalid data is good, but the widget should also not pretend all was OK to the user, and surface the API errors to the user.

Acceptance criteria:

When the API response contains the error, it is displayed to the user using the standard "error bubble".

Scenarios

GIVEN I am on the lexeme page
AND I edit the lexeme header
WHEN I remove all lemmas
AND I click the save button
THEN The error message "An error has occurred: The last Lemma can not be removed." is displayed

GIVEN I am on the lexeme page
AND I edit the lexeme header
WHEN I click the save button
AND One of API error occurs
THEN The error message "An error has occurred: save has failed" or "An error has occurred: unexpected error" is displayed

API errors:

  • Save has failed
  • unexpected error
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 10 2018, 6:57 AM
WMDE-leszek triaged this task as High priority.Apr 10 2018, 6:57 AM

Change 425268 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/WikibaseLexeme@master] Show errors for lexeme header elements.

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

WMDE-leszek updated the task description. (Show Details)Apr 10 2018, 2:46 PM
WMDE-leszek updated the task description. (Show Details)
RazShuty set the point value for this task to 2.

Change 425268 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Show errors for lexeme header elements.

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

Lydia_Pintscher added a subscriber: Lydia_Pintscher.

I just tried it with Léa and the message that is shown when the last Lemma is removed is "The save has failed." It should be "An error has occurred: The last Lemma can not be removed." as described in the task description.

Jakob_WMDE moved this task from To Do to Doing on the Wikidata-Turtles-Sprint#3 board.

Change 427441 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/WikibaseLexeme@master] Show an error in the LexemeHeader widget when attempting to remove the last lemma

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

@Lydia_Pintscher, why should an error message that can clearly be identified as an error message say "an error has occurred"? I just saw this in the patch. I think this is not only redundant but counter-productive.

Also the message "the last Lemma can not be removed" is actually wrong, because the user already removed the last Lemma. It's just that a Lexeme with no Lemma can not be saved, and the save button refuses to work because of this. This is what the message should say.

Can you please go back to the design team and fix this?

Change 427441 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Show an error in the LexemeHeader widget when attempting to remove the last lemma

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

Lydia_Pintscher closed this task as Resolved.Apr 23 2018, 8:46 AM

This is fine for the first release.