-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bugfix] Parse on errorMatcher.set / handle no errorMatcher correctly #145
Conversation
I tried to rebase this and run the test but I can't get it to work. Do you have time to look into this? |
Done. |
}; | ||
|
||
ErrorMatcher.prototype._goto = function (id) { | ||
var match = _.findWhere(this.currentMatch, { id: id }); | ||
if (!match) { | ||
throw new Error('Can\'t find match with id ' + id); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem like this can ever occur. In the _gotoNext
function it is protected by a check for 0 === this.currentMatch.length
, and in the matchFirst
function it is checked that there actually is a first match.
(If I missed some case where it actually happens, it should emit
the error rather than throwing).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're correct, that it schouldn't happen. It's more like defensive programming, if the other functions change in the future. But you are also correct, that it should emit an error.
[Bugfix] Parse on errorMatcher.set / handle no errorMatcher correctly
Thank you so much for this! Once again, sorry for taking so long to review this |
This PR fixes two bugs: