mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
Show HTTP status alongside 'Unknown error' when it's not 200
Change-Id: If14dc14f2cc43a1f12c1314342d5028ec524c31e
This commit is contained in:
parent
5d5645565f
commit
a9feb8869c
|
@ -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 );
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue