Show HTTP status alongside 'Unknown error' when it's not 200

Change-Id: If14dc14f2cc43a1f12c1314342d5028ec524c31e
This commit is contained in:
Alex Monk 2016-12-16 11:28:38 +00:00
parent 5d5645565f
commit a9feb8869c

View file

@ -785,13 +785,18 @@ ve.init.mw.ArticleTarget.prototype.saveErrorBadToken = function ( username, erro
*/
ve.init.mw.ArticleTarget.prototype.saveErrorUnknown = function ( editApi, data ) {
var errorMsg = ( editApi && editApi.info ) || ( data && data.error && data.error.info ),
errorCode = ( editApi && editApi.code ) || ( data && data.error && data.error.code );
errorCode = ( editApi && editApi.code ) || ( data && data.error && data.error.code ),
unknown = 'Unknown error';
if ( data.xhr.status !== 200 ) {
unknown += ', HTTP status ' + data.xhr.status;
}
this.showSaveError(
$( document.createTextNode( errorMsg || errorCode || 'Unknown error' ) ),
$( document.createTextNode( errorMsg || errorCode || unknown ) ),
false // prevents reapply
);
this.emit( 'saveErrorUnknown', errorCode || errorMsg || 'Unknown error' );
this.emit( 'saveErrorUnknown', errorCode || errorMsg || unknown );
};
/**