| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Change-Id: Ia5d59fb9acb7e9b38696b61ea206ee7764ab9094
|
|
|
|
|
|
|
| |
Temporarily disable no-var & prefer-const as resulting errors
need to be fixed manually.
Change-Id: I6cb62a2c70a4c1fc265a00b1f18af127ac9d5029
|
|
|
|
| |
Change-Id: Iddfa574e42e569ac5e2a2b098ad2f11ca80c5955
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Given an API response indicating an error, it returns a jQuery object
containing a human-readable error message that you can display
somewhere on the page.
Handling the "real" API responses from the server is easy, since they
already contain the error message and we basically just extract it.
The important part of this patch is handling the issues that happen
on the client, or server-side issues where the error-handling API
code never runs, so we have to figure out what happened and make up
our own error message.
I have not yet seen any mw.Api consumer that handles all the error
cases correctly (I thought VisualEditor did, but in the process of
writing this patch I learned that we missed a few cases there as
well), and most don't even try. This might not be perfect but it
should be the closest thing so far.
The new code is inspired by error handling in VisualEditor (see
I69d9432162f195dcfe9470485b549a1b007617ff) and in mw.Upload.BookletLayout.
New messages:
* 'api-clientside-error-noconnect'
- Adapted from 'apierror-offline' and 'visualeditor-error-noconnect'
* 'api-clientside-error-http'
- Adapted from 'visualeditor-loadwarning' and 'visualeditor-error-http'
* 'api-clientside-error-timeout'
- Copied from 'apierror-timeout'
* 'api-clientside-error-aborted'
- Entirely new
* 'api-clientside-error-invalidresponse'
- Copied from 'visualeditor-error-invalidresponse'
Update some existing code to use it, as an example:
* mediawiki.page.watch.ajax
- Removed messages: 'watcherrortext'
* mediawiki.special.unwatchedPages
- Removed messages: 'watcherrortext'
* mediawiki.action.edit.preview
- (errors were hardcoded in English)
* mediawiki.feedback
- Removed messages: 'feedback-error2', 'feedback-error3'
(error1 and error4 remain, they handle errors not caused by the API)
* mediawiki.Upload.BookletLayout
- Removed messages: 'apierror-timeout', 'apierror-offline', 'apierror-unknownerror'
* mediawiki.page.ready
- Removed messages: 'logout-failed'
* 'mediawiki.page.patrol.ajax
- (the messages are already used by the patrol API)
Example usages in extensions:
* VisualEditor: I69d9432162f195dcfe9470485b549a1b007617ff
* DiscussionTools: Ice92fafb1f546510dab28e3f8aa7d2280668965a
Bug: T240519
Change-Id: Ie18666b41f4aff1ab4bcf93f9df6e3000ac7b500
|
|
|
|
| |
Change-Id: I7df5840bc97f8bbcd8cfc875c2b48b3061ef2c9e
|
|
|
|
| |
Change-Id: I2930bcabeeb7b7b2eb36063e77b26e664a691b43
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follows-up Id6d13bbea6:
- '$': mw.loader.implement does this already.
- 'mw': Use the canonical name directly.
This replaces the following patterns:
File closures (common):
- `( function ( $, mw ) {` => `( function () {`
- `( function ( $ ) {` => `( function () {`
- `( function ( mw ) {` => `( function () {`
- `( function ( mw, $ ) {` => `( function () {`
File closures (rare):
- `( function ( mw, $, OO ) {` => `( function () {`
- `( function ( mw, OO, $ ) {` => `( function () {`
- `( function ( mw, document ) {` => `( function () {`
Combined dom-ready and file closure (rare):
- `jQuery( function ( $ ) {` => `$( function () {
- `jQuery( function () {` => `$( function () {
Remaining references in files without a closure, as found by
the new ESLint setting (rare):
- `jQuery` => `$`
- `mediaWiki` => `mw`
Change-Id: I7cf2426cde597259e8c6f3f6f615a1a81a0ca82b
|
|
Bug: T193826
Change-Id: Id25cd18079f48308f6ab42207445bbbd74ed5fda
|