Merge "Prefer error *code* when logging unknown errors"

This commit is contained in:
jenkins-bot 2016-03-14 01:01:48 +00:00 committed by Gerrit Code Review
commit 0cdf4393ed

View file

@ -665,17 +665,14 @@ ve.init.mw.ArticleTarget.prototype.saveErrorBadToken = function ( username, erro
* @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';
var errorMsg = ( editApi && editApi.info ) || ( data && data.error && data.error.info ),
errorCode = ( editApi && editApi.code ) || ( data && data.error && data.error.code );
this.showSaveError(
$( document.createTextNode( errorMsg ) ),
$( document.createTextNode( errorMsg || errorCode || 'Unknown error' ) ),
false // prevents reapply
);
this.emit( 'saveErrorUnknown', errorMsg );
this.emit( 'saveErrorUnknown', errorCode || errorMsg || 'Unknown error' );
};
/**