From 37bb297e76a3da6939941fcdd143dac9c06f333e Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 4 Mar 2021 20:37:37 -0500 Subject: [PATCH] Changeset: Improve logged error message I saw this on a production system today and wanted more information. --- src/static/js/Changeset.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/static/js/Changeset.js b/src/static/js/Changeset.js index b5e72f477..bdf25f7de 100644 --- a/src/static/js/Changeset.js +++ b/src/static/js/Changeset.js @@ -907,7 +907,11 @@ const textLinesMutator = (lines) => { // there may be more chars in the line (newline is not reached) const sline = putCurLineInSplice(); if (!curSplice[sline]) { - console.error('curSplice[sline] not populated, actual curSplice contents is ', curSplice, '. Possibly related to https://github.com/ether/etherpad-lite/issues/2802'); + const err = new Error( + 'curSplice[sline] not populated, actual curSplice contents is ' + + `${JSON.stringify(curSplice)}. Possibly related to ` + + 'https://github.com/ether/etherpad-lite/issues/2802'); + console.error(err.stack || err.toString()); } curSplice[sline] = curSplice[sline].substring(0, curCol) + text + curSplice[sline].substring(curCol);