From 84d534997e102d5aa1cfdea317f40caa8b05dd51 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Fri, 4 Mar 2016 16:46:12 -0800 Subject: [PATCH] Follow-up 2c24efae: fix typo in event name for unknown save errors This probably means we stopped logging unknown save errors back in August. Change-Id: I4a5bac244a469e73643e8a7d978d9212dd838fb0 --- .../ve-mw/init/ve.init.mw.ArticleTarget.js | 19 ++++++++++--------- .../init/ve.init.mw.ArticleTargetEvents.js | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js index 6ec0510f46..8a6e234014 100644 --- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js +++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js @@ -120,6 +120,7 @@ OO.inheritClass( ve.init.mw.ArticleTarget, ve.init.mw.Target ); /** * @event saveErrorUnknown + * @param {string} errorMsg Error message shown to the user * Fired for any other type of save error */ @@ -654,20 +655,20 @@ ve.init.mw.ArticleTarget.prototype.saveErrorNewUser = function ( username ) { * @method * @param {Object} editApi * @param {Object|null} data API response data - * @fires onSaveErrorUnknown + * @fires saveErrorUnknown */ 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( - $( document.createTextNode( - ( editApi && editApi.info ) || - ( data.error && data.error.info ) || - ( editApi && editApi.code ) || - ( data.error && data.error.code ) || - 'Unknown error' - ) ), + $( document.createTextNode( errorMsg ) ), false // prevents reapply ); - this.emit( 'onSaveErrorUnknown' ); + this.emit( 'saveErrorUnknown', errorMsg ); }; /** diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js b/modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js index 256702389a..c6c10f8780 100644 --- a/modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js +++ b/modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js @@ -149,8 +149,8 @@ ve.init.mw.ArticleTargetEvents.prototype.trackSaveError = function ( type ) { type: typeMap[ type ] || 'responseUnknown', timing: ve.now() - this.timings.saveInitiated + ( this.timings.serializeForCache || 0 ) }; - if ( type === 'unknown' && failureArguments[ 1 ].error && failureArguments[ 1 ].error.code ) { - data.message = failureArguments[ 1 ].error.code; + if ( type === 'unknown' && failureArguments[ 1 ] ) { + data.message = failureArguments[ 1 ]; } ve.track( 'mwedit.saveFailure', data ); };