Skip to content

Commit

Permalink
Only use the error from the context when the error position is higher
Browse files Browse the repository at this point in the history
  • Loading branch information
bandesz committed Nov 7, 2018
1 parent 3e2b83c commit 8331a5a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parsley/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func Parse(ctx *Context, p Parser) (Node, error) {
var node Node

if node, _, err = p.Parse(ctx, data.EmptyIntMap, ctx.Reader().Pos(0)); err != nil {
if ctxErr := ctx.Error(); ctxErr != nil && ctxErr.Pos() >= err.Pos() {
if ctxErr := ctx.Error(); ctxErr != nil && ctxErr.Pos() > err.Pos() {
err = ctxErr
}

Expand Down

0 comments on commit 8331a5a

Please sign in to comment.