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