Log more precise error codes for timeout etc. (and HTTP statuses)

Inspired by the code in mw.Api#getErrorMessage handling these cases.

Bug: T290514
Change-Id: I2eea17198dafaf9d3c4754cfb630de0ed7162daf
This commit is contained in:
Bartosz Dziewoński 2021-09-09 22:57:42 +02:00
parent 085ea2e8d1
commit b52699ad35

View file

@ -779,6 +779,13 @@ ReplyWidget.prototype.onReplyClick = function () {
widget.errorMessage.$element.insertBefore( widget.replyBodyWidget.$element );
}
// Log more precise error codes, mw.Api just gives us 'http' in all of these cases
if ( data.textStatus === 'timeout' || data.textStatus === 'abort' || data.textStatus === 'parsererror' ) {
code = data.textStatus;
} else {
code = 'http-' + ( ( data.xhr && data.xhr.status ) || 0 );
}
logger( {
action: 'saveFailure',
message: code,