Prefer error *code* when logging unknown errors

See also I4a5bac24

Change-Id: I62fda9dadd24704f5930b30a2f8ad4d4a9e729cb
This commit is contained in:
Alex Monk 2016-03-11 17:34:53 +00:00
parent d1d4839f8f
commit 612e43dc08

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