From 5b37cff1e9792a7d7d6e9dd0919576e0f9edd092 Mon Sep 17 00:00:00 2001 From: eliot-akira Date: Sun, 3 Oct 2021 03:58:46 +0200 Subject: [PATCH] Use template literals for string interpolation --- lib/persistence.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/persistence.js b/lib/persistence.js index a60a80f..50a77d3 100755 --- a/lib/persistence.js +++ b/lib/persistence.js @@ -215,7 +215,8 @@ class Persistence { lineStream.on('end', () => { // A bit lenient on corruption if (length > 0 && corruptItems / length > this.corruptAlertThreshold) { - const err = new Error('More than ' + Math.floor(100 * this.corruptAlertThreshold) + '% of the data file is corrupt, the wrong beforeDeserialization hook may be used. Cautiously refusing to start NeDB to prevent dataloss') + const corruptPercent = Math.floor(100 * this.corruptAlertThreshold) + const err = new Error(`More than ${corruptPercent}% of the data file is corrupt, the wrong beforeDeserialization hook may be used. Cautiously refusing to start NeDB to prevent dataloss`) cb(err, null) return }