Revert "editcheck: Remove try/catch around transaction squashing"

This reverts commit cf8a08f76c.

Reason for revert: these errors are still happening

Bug: T333710
Bug: T380234
Change-Id: I4b4a061757316bf720fecc7cfd971737b68d122f
This commit is contained in:
DLynch 2024-11-19 02:02:03 +00:00
parent cf8a08f76c
commit 733d0a835e

View file

@ -59,7 +59,16 @@ mw.editcheck.getModifiedRanges = function ( documentModel, coveredNodesOnly ) {
if ( !documentModel.completeHistory.getLength() ) {
return [];
}
const operations = documentModel.completeHistory.squash().transactions[ 0 ].operations;
let operations;
try {
operations = documentModel.completeHistory.squash().transactions[ 0 ].operations;
} catch ( err ) {
// TransactionSquasher can sometimes throw errors; until T333710 is
// fixed just count this as not needing a reference.
mw.errorLogger.logError( err, 'error.visualeditor' );
return [];
}
const ranges = [];
let offset = 0;
const endOffset = documentModel.getDocumentRange().end;