Page MenuHomePhabricator

in ReadingLists api error message keys should begin with "apierror"
Closed, ResolvedPublic


Usually, message keys of api help, api warning, and api error messages begin with the strings "apihelp", "apiwarn", or "apierror".

This doesn't seem to be the case with the ReadingLists extension, which has keys like readinglists-apierror-project-title-param. As far as I can see, it would be nice to make this consistent and rename them to something like apierror-readinglists-project-title-param, although it's possible that @Tgr, @Nikerabbit, @Raymond, and @Anomie will have a different opinion.


Event Timeline

Amire80 created this task.Dec 10 2017, 5:10 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 10 2017, 5:10 PM
Reedy added a subscriber: Reedy.Dec 10 2017, 5:46 PM

A quick glance over mw core and extensions. it does seem most api error messages use the format you're suggesting

Yes, the convention is to prefix messages with "apihelp", "apiwarn", or "apierror". Most extensions use that convention because I did that when mass-converting everything to the new i18n help and error messages. On the other hand, it does go against the wider convention of prefixing all extension messages with some version of the extension's name.

The apihelp prefix is encouraged by the fact that if you don't follow it you have to override the default message names everywhere.

The other two aren't so encouraged. While the API will turn "apierror-readinglists-project-title-param" into a slightly nicer error code by stripping off the "apierror-" prefix, it's still reasonably likely that you'll override the code to something shorter than "readinglists-project-title-param".

Amire80 moved this task from Untriaged to Message keys names on the I18n board.Feb 3 2018, 12:14 PM

Change 412243 had a related patch set uploaded (by Gergő Tisza; owner: Gergő Tisza):
[mediawiki/extensions/ReadingLists@master] Rename API error messages to match convention

Tgr added a comment.Feb 18 2018, 8:32 AM

RESTBase patch: #956

Change 412243 merged by jenkins-bot:
[mediawiki/extensions/ReadingLists@master] Rename API error messages to match convention

Tgr closed this task as Resolved.Feb 21 2018, 7:37 PM
mobrovac added a subscriber: mobrovac.

FYI, the RESTBase patch for this issue was deployed today.

Aklapper removed a subscriber: Anomie.Fri, Oct 16, 5:39 PM