daniel added a comment.

After some more discussion, especially with Adrian, and some more consolidation 
in the API code as well as changes to the core API, where's what I now think:

First of all, consider that the caller (the UI) usually knows best what the 
user was trying to do, while the responder (the server) knows best what went 
wrong. Also, let's assume that the purpose of haven a "details" section which 
is hidden per default is mainly to provide technical information to bug 
reports. 

Following this, I believe error dialogs should consist of three parts:

  # A title, provided by the UI code, briefly indicating what action was being 
performed ("Error while saving a sitelink", "Error while tweaking the frob").
  # An error message indicating the problem, as reported by the server. This 
should be taken from the `response.error.messages[*].['html']` field in the API 
response if present. If not present, we could either use the English message 
from `response.error.info`, or provide a localized message based on 
response.error.code.
  # A details section, collapsed per default, containing (in small, monospace 
type):
    - The request URI and POST data (with any tokens stripped)
    - The full response JSON
    - user groups (possibly also user name and/or id)
    - data/time
    - software version(s) (if we can easily do this)

For reference, an error response from the API:
```
    "error": {
        "code": "no-such-entity",
        "info": "Could not find such an entity (Invalid id: asdfasdf)",
        "messages": [
            {
                "name": "wikibase-api-no-such-entity",
                "parameters": [],
                "html": {
                    "*": "Could not find such an entity"
                }
            }
        ],
        "*": "See https://www.wikidata.org/w/api.php for API usage"
    }
```

The example isn't perfect (that message should actually have the bad ID as a 
parameter, and the message could be more specific), but it should serve the 
purpose here.

TASK DETAIL
  https://phabricator.wikimedia.org/T54843

REPLY HANDLER ACTIONS
  Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign 
<username>.

To: daniel
Cc: Snaterlicious, adrianlang, JohnLewis, thiemowmde, Lydia_Pintscher, daniel, 
Wikidata-bugs, aude



_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to