Page MenuHomePhabricator

Adapt front-end to understand new errors after returning HTTP error codes
Closed, ResolvedPublicBUG REPORT

Description

Description

Before, the API error responses were:

{
    "error": {
        "code": "wikilambda-zerror",
        "info": "Error of type Z554",
        "message": "Label for a given language clashes with another Object's label",
        "zerror": {
           ...
        },
        "labelled": {
           ...
        }
    }
}

After this change https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiLambda/+/1015290 the responses are:

{
    "xhr": {
        "readyState": 4,
        "responseText": "{\"error\":{\"code\":\"wikilambda-zerror\",\"info\":\"Error of type Z554\",\"message\":\"Label for a given language clashes with another Object's label\",\"zerror\":{\"Z1K1\":\"Z5\",\"Z5K1\":\"Z554\",\"Z5K2\":{\"Z1K1\":{\"Z1K1\":\"Z7\",\"Z7K1\":\"Z885\",\"Z885K1\":\"Z554\"},\"K1\":{\"Z1K1\":\"Z6\",\"Z6K1\":\"Z10000\"},\"K2\":{\"Z1K1\":\"Z6\",\"Z6K1\":\"Z1002\"}}},\"labelled\":{\"type\":\"Error\",\"error type\":\"Label for a given language clashes with another Object's label\",\"error value\":{\"type\":{\"type\":\"Function call\",\"function\":\"Errortype to type\",\"errortype\":\"Label for a given language clashes with another Object's label\"},\"clashing ZID\":{\"type\":\"String\",\"value\":\"Date\"},\"language\":{\"type\":\"String\",\"value\":\"English\"}}},\"*\":\"See http://localhost:8080/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes.\"},\"servedby\":\"49744f6ca153\"}",
        "responseJSON": {
            "error": {
                "code": "wikilambda-zerror",
                "info": "Error of type Z554",
                "message": "Label for a given language clashes with another Object's label",
                "zerror": {},
                "labeled": {}
            }
        }
    }
}

We need to adapt all the front-end error handling to this change in the failure response.


Completion checklist

Event Timeline

gengh updated the task description. (Show Details)
gengh updated the task description. (Show Details)

Change #1016393 had a related patch set uploaded (by Genoveva Galarza; author: Genoveva Galarza):

[mediawiki/extensions/WikiLambda@master] [WIP] Centralize API calls in api.js mixin

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

Change #1016393 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Centralize API calls in api.js mixin and fix error handling

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

Change #1016778 had a related patch set uploaded (by Jforrester; author: Genoveva Galarza):

[mediawiki/extensions/WikiLambda@wmf/1.42.0-wmf.25] Centralize API calls in api.js mixin and fix error handling

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

Change #1016778 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@wmf/1.42.0-wmf.25] Centralize API calls in api.js mixin and fix error handling

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

Mentioned in SAL (#wikimedia-operations) [2024-04-03T20:08:52Z] <jforrester@deploy1002> Started scap: Backport for [[gerrit:1016778|Centralize API calls in api.js mixin and fix error handling (T361598 T315432)]]

Mentioned in SAL (#wikimedia-operations) [2024-04-03T20:11:18Z] <jforrester@deploy1002> jforrester: Backport for [[gerrit:1016778|Centralize API calls in api.js mixin and fix error handling (T361598 T315432)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-04-03T20:23:50Z] <jforrester@deploy1002> Finished scap: Backport for [[gerrit:1016778|Centralize API calls in api.js mixin and fix error handling (T361598 T315432)]] (duration: 14m 58s)