Skip to content

Commit

Permalink
Keep original stack trace for exceeded repetition errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
tdecaluwe committed Nov 11, 2020
1 parent 4e00a43 commit 3863dca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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`;
}
}

Expand All @@ -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 = [];
Expand Down

0 comments on commit 3863dca

Please sign in to comment.