Page MenuHomePhabricator

Make Wikibase error message "Malformed input" more meaningful
Open, Needs TriagePublic

Description

Main components:

  • Action API

User story:
As an API editor
I want to get better feedback on malformed string input
in order to fix my calls.

Problem:
If one is using a malformed string value in an API edit, the users get a "Malformed input" error message. Currently, this error message does not help to find the problem in the string. More assistance would be helpful e.g. for cases of invisible or otherwise indistinguishable characters.

Screenshots:

Screen Shot 2022-03-23 at 6.05.16 PM.png (990×1 px, 405 KB)

Solution:
Improve the error message you get from the API for bad strings. Currently, it’s a generic “malformed value” message, but it should be possible to provide a custom message without too much trouble (ValidatorBuilders::getCommonStringValidators() uses a RegexValidator to check whitespace, which already supports a custom $errorCode as an optional constructor argument). We could also point users to wbparsevalue.

Notes:

Acceptance criteria:

  • Malformed input error message should be more helpful/actionable for the users.

    Open questions:
  • What exactly should the new message be?

    Original:

T47925#7796836 and following

Event Timeline

Sure, feel free to upload a patch on Gerrit. Wikibase/Installation might be useful to set up a local wiki where you can test the behavior.

I would love to see this improved. I often get this generic error when an empty string is passed with a string property. I would also really like to know which property was related to the input error so I don't have to scan through tens of properties to find the anomaly manually.

@gabbyprecious: Hi! This task has been assigned to you a while ago. Could you maybe share an update? Do you still plan to work on this task, or do you need any help?

@gabbyprecious: I am resetting the assignee of this task because there has not been progress lately (please correct me if I am wrong!). Resetting the assignee avoids the impression that somebody is already working on this task. It also allows others to potentially work towards fixing this task. Please claim this task again when you plan to work on it (via Add Action...Assign / Claim in the dropdown menu) - it would be welcome. Thanks for your understanding!