From 3863dcab00098d5e2b7151ece9e4bd55a688a4cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20De=20Caluw=C3=A9?= Date: Wed, 11 Nov 2020 00:50:53 -0500 Subject: [PATCH] Keep original stack trace for exceeded repetition errors. --- tracker.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tracker.js b/tracker.js index 71edf84..f857428 100644 --- a/tracker.js +++ b/tracker.js @@ -45,8 +45,6 @@ Tracker.prototype.reset = function () { this.stack[0].count = 0; } -/* eslint-disable complexity */ - /** * Match a segment to the message table and update the current * position of the tracker. @@ -74,7 +72,7 @@ Tracker.prototype.accept = function (segment) { // Check if the current position is not a group. if (content.constructor === String) { if (pointer.repetition() === pointer.count && content === segment) { - error = new Error(`Segment ${segment} was repeated too much`); + error.message = `Segment ${segment} was repeated too much`; } } @@ -85,6 +83,8 @@ Tracker.prototype.accept = function (segment) { return result; } +/* eslint-disable complexity */ + Tracker.prototype.process = function (segment, metadata) { var current = this.stack[this.stack.length - 1]; var optionals = [];