mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 16:20:52 +00:00
Merge "Follow-up 2c24efae
: fix typo in event name for unknown save errors"
This commit is contained in:
commit
074885d7cf
|
@ -120,6 +120,7 @@ OO.inheritClass( ve.init.mw.ArticleTarget, ve.init.mw.Target );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @event saveErrorUnknown
|
* @event saveErrorUnknown
|
||||||
|
* @param {string} errorMsg Error message shown to the user
|
||||||
* Fired for any other type of save error
|
* Fired for any other type of save error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -654,20 +655,20 @@ ve.init.mw.ArticleTarget.prototype.saveErrorNewUser = function ( username ) {
|
||||||
* @method
|
* @method
|
||||||
* @param {Object} editApi
|
* @param {Object} editApi
|
||||||
* @param {Object|null} data API response data
|
* @param {Object|null} data API response data
|
||||||
* @fires onSaveErrorUnknown
|
* @fires saveErrorUnknown
|
||||||
*/
|
*/
|
||||||
ve.init.mw.ArticleTarget.prototype.saveErrorUnknown = function ( editApi, data ) {
|
ve.init.mw.ArticleTarget.prototype.saveErrorUnknown = function ( editApi, data ) {
|
||||||
|
var errorMsg = ( editApi && editApi.info ) ||
|
||||||
|
( data && data.error && data.error.info ) ||
|
||||||
|
( editApi && editApi.code ) ||
|
||||||
|
( data && data.error && data.error.code ) ||
|
||||||
|
'Unknown error';
|
||||||
|
|
||||||
this.showSaveError(
|
this.showSaveError(
|
||||||
$( document.createTextNode(
|
$( document.createTextNode( errorMsg ) ),
|
||||||
( editApi && editApi.info ) ||
|
|
||||||
( data.error && data.error.info ) ||
|
|
||||||
( editApi && editApi.code ) ||
|
|
||||||
( data.error && data.error.code ) ||
|
|
||||||
'Unknown error'
|
|
||||||
) ),
|
|
||||||
false // prevents reapply
|
false // prevents reapply
|
||||||
);
|
);
|
||||||
this.emit( 'onSaveErrorUnknown' );
|
this.emit( 'saveErrorUnknown', errorMsg );
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -149,8 +149,8 @@ ve.init.mw.ArticleTargetEvents.prototype.trackSaveError = function ( type ) {
|
||||||
type: typeMap[ type ] || 'responseUnknown',
|
type: typeMap[ type ] || 'responseUnknown',
|
||||||
timing: ve.now() - this.timings.saveInitiated + ( this.timings.serializeForCache || 0 )
|
timing: ve.now() - this.timings.saveInitiated + ( this.timings.serializeForCache || 0 )
|
||||||
};
|
};
|
||||||
if ( type === 'unknown' && failureArguments[ 1 ].error && failureArguments[ 1 ].error.code ) {
|
if ( type === 'unknown' && failureArguments[ 1 ] ) {
|
||||||
data.message = failureArguments[ 1 ].error.code;
|
data.message = failureArguments[ 1 ];
|
||||||
}
|
}
|
||||||
ve.track( 'mwedit.saveFailure', data );
|
ve.track( 'mwedit.saveFailure', data );
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue