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
(cherry picked from commit 733d0a835e)
This commit is contained in:
DLynch 2024-11-19 02:02:03 +00:00
parent ae9717975a
commit 4001421681

View file

@ -59,7 +59,16 @@ mw.editcheck.getModifiedRanges = function ( documentModel, coveredNodesOnly ) {
if ( !documentModel.completeHistory.getLength() ) { if ( !documentModel.completeHistory.getLength() ) {
return []; 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 = []; const ranges = [];
let offset = 0; let offset = 0;
const endOffset = documentModel.getDocumentRange().end; const endOffset = documentModel.getDocumentRange().end;