Merge "Follow-up 2c24efae: fix typo in event name for unknown save errors"

This commit is contained in:
jenkins-bot 2016-03-05 02:01:57 +00:00 committed by Gerrit Code Review
commit 074885d7cf
2 changed files with 12 additions and 11 deletions

View file

@ -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 );
}; };
/** /**

View file

@ -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 );
}; };