https://bugzilla.wikimedia.org/show_bug.cgi?id=52843

Daniel Kinzler <daniel.kinz...@wikimedia.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |62824

--- Comment #5 from Daniel Kinzler <daniel.kinz...@wikimedia.de> ---
The API already provides localized errors in some cases. I suggest to show that
localized error in full if it exists. The structured returned by the API will
look something like this:

  {
    "error": {
        "code": "invalid-snak-value",
        "info": "Malformed URL: asldkjf",
        "messages": {
            "0": {
                "name": "wikibase-validator-bad-url",
                "type": "error",
                "parameters": [
                    "asldkjf"
                ]
            },
            "html": {
                "*": "<p>Malformed URL: asldkjf\n</p>"
            }
        }
    }
  }

So, if result[error][messages][html] is defined, we can just show it, it's
intended for the user.

If that is not set, we will only have a "traditional" API error:

 {
    "error": {
        "code": "invalid-guid",
        "info": "Invalid claim guid"
    }
 }

In that case, we should do what we do now: show a localized message based on
the code, and show what's in "info" under "details".

Not that the error info is, by convention, not localized. This is the first
parameter passed to dieUsage(), and we should double-check that we don't
localize it (e.g. it seems we are returning a localized message for invalid
edit tokens).

The error info should be treated as a plain value (html escaping must be
applied). Linebreaks may be significant and should be preserved (using <pre> or
<br/>): in some cases, the error info will contain a stack trace (at least if
wgShowExceptionDetails is enabled).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to