From daf5d9752de0f29a09a4e5fa11d5aad5de5de984 Mon Sep 17 00:00:00 2001 From: DLynch Date: Tue, 19 Nov 2024 02:02:03 +0000 Subject: [PATCH] Revert "editcheck: Remove try/catch around transaction squashing" This reverts commit cf8a08f76ca7a68978dfea4a8975745208d1224d. Reason for revert: these errors are still happening Bug: T333710 Bug: T380234 Change-Id: I4b4a061757316bf720fecc7cfd971737b68d122f (cherry picked from commit 733d0a835e1716970deaa42b6e34025c55432bd8) --- editcheck/modules/init.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/editcheck/modules/init.js b/editcheck/modules/init.js index c9d426cf34..e323db572d 100644 --- a/editcheck/modules/init.js +++ b/editcheck/modules/init.js @@ -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;