https://bugzilla.wikimedia.org/show_bug.cgi?id=64874
Bug ID: 64874
Summary: Use ApiErrorReporter for all API errors.
Product: MediaWiki extensions
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: WikidataRepo
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Web browser: ---
Mobile Platform: ---
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).
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l