Last modified: 2014-07-23 14:11:56 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T66874, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 64874 - Use ApiErrorReporter for all API errors.
Use ApiErrorReporter for all API errors.
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
WikidataRepo (Other open bugs)
unspecified
All All
: High normal (vote)
: ---
Assigned To: Wikidata bugs
u=dev c=backend p=0
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-05 10:28 UTC by Daniel Kinzler
Modified: 2014-07-23 14:11 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Daniel Kinzler 2014-05-05 10:28:01 UTC
The APiErrorReporter provides unified formatting and localization for all API errors, but is so far not used in all modules / for all cases. The WikibaseApi base class provides convenience functions that delegate to an APiErrorReporter, so replacing the old dieUsage calls should be as easy as:

* dieStatus if you have a Status object
* dieException if you have an Exception
* dieError otherwise (this has the same signature as dieUsage, but applies localization if possible).

All of these take API error codes; they will be passed on to dieUsage as before, but in addition, are used to find an appropriate system message for a localized error message. The message key is constructed as 'wikibase-api-' . $errorCode. If you use the new functions, please also provide the appropriate system messages.

Note that dieException uses an ExceptionLocalizer which may provide a more detailed error message, and die Status will take messages from the Status object, if there are any, so the message based on the error code may not always be used (this may be changed to just combine all the messages, instead of having the override each other).
Comment 1 Daniel Kinzler 2014-05-13 11:29:21 UTC
marius, can you look into that?
Comment 2 Gerrit Notification Bot 2014-07-23 09:35:34 UTC
Change 148622 had a related patch set uploaded by Hoo man:
Made all API modules use ApiErrorReporter

https://gerrit.wikimedia.org/r/148622
Comment 3 Gerrit Notification Bot 2014-07-23 14:10:44 UTC
Change 148622 merged by jenkins-bot:
Made all API modules use ApiErrorReporter

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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links