Page MenuHomePhabricator

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

Description

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.

Thanks!

Event Timeline

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".

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

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

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

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