mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 03:08:42 +00:00
ve.init.mw.DesktopArticleTarget: Remove dead error handling code
The .statusText and .status properties belong to the XMLHttpRequest object, and are not present on the API response data object. I think these checks were left over "just in case" when this code was ported to use mw.Api instead of XMLHttpRequest directly. MediaWiki API should never return just 'error' as the error code. Change-Id: Iac6f721881b9405919d3397df6606e54f182bc59
This commit is contained in:
parent
ef8ff1723a
commit
a2b556ed56
|
@ -682,33 +682,30 @@ ve.init.mw.DesktopArticleTarget.prototype.loadFail = function ( code, errorDetai
|
|||
}
|
||||
|
||||
// Don't show an error if the load was manually aborted
|
||||
// The response.status check here is to catch aborts triggered by navigation away from the page
|
||||
errorInfo = ve.getProp( errorDetails, 'error', 'info' ) || errorDetails;
|
||||
|
||||
if ( !errorDetails || errorDetails.statusText !== 'abort' ) {
|
||||
if ( code === 'http' || code === 'error' ) {
|
||||
if ( errorDetails && ( errorDetails.status || ( errorDetails.xhr && errorDetails.xhr.status ) ) ) {
|
||||
confirmPromptMessage = ve.msg(
|
||||
'visualeditor-loadwarning',
|
||||
ve.msg( 'visualeditor-error-http', errorDetails.status || errorDetails.xhr.status )
|
||||
);
|
||||
} else {
|
||||
confirmPromptMessage = ve.msg(
|
||||
'visualeditor-loadwarning',
|
||||
ve.msg( 'visualeditor-error-noconnect' )
|
||||
);
|
||||
}
|
||||
} else if ( errorInfo ) {
|
||||
if ( code === 'http' ) {
|
||||
if ( errorDetails && errorDetails.xhr && errorDetails.xhr.status ) {
|
||||
confirmPromptMessage = ve.msg(
|
||||
'visualeditor-loadwarning',
|
||||
code + ve.msg( 'colon-separator' ) + errorInfo
|
||||
ve.msg( 'visualeditor-error-http', errorDetails.xhr.status )
|
||||
);
|
||||
} else if ( typeof errorDetails === 'string' ) {
|
||||
confirmPromptMessage = errorDetails;
|
||||
} else {
|
||||
// At least give the devs something to work from
|
||||
confirmPromptMessage = JSON.stringify( errorDetails );
|
||||
confirmPromptMessage = ve.msg(
|
||||
'visualeditor-loadwarning',
|
||||
ve.msg( 'visualeditor-error-noconnect' )
|
||||
);
|
||||
}
|
||||
} else if ( errorInfo ) {
|
||||
confirmPromptMessage = ve.msg(
|
||||
'visualeditor-loadwarning',
|
||||
code + ve.msg( 'colon-separator' ) + errorInfo
|
||||
);
|
||||
} else if ( typeof errorDetails === 'string' ) {
|
||||
confirmPromptMessage = errorDetails;
|
||||
} else {
|
||||
// At least give the devs something to work from
|
||||
confirmPromptMessage = JSON.stringify( errorDetails );
|
||||
}
|
||||
|
||||
if ( confirmPromptMessage ) {
|
||||
|
@ -727,9 +724,7 @@ ve.init.mw.DesktopArticleTarget.prototype.loadFail = function ( code, errorDetai
|
|||
}
|
||||
} );
|
||||
} else {
|
||||
if ( errorDetails.statusText !== 'abort' ) {
|
||||
mw.log.warn( 'Failed to find error message', code, errorDetails );
|
||||
}
|
||||
mw.log.warn( 'Failed to find error message', code, errorDetails );
|
||||
this.tryTeardown( true );
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue