Skip to content

Commit

Permalink
Merge pull request #194 from nakabonne/fix-path-not-found
Browse files Browse the repository at this point in the history
Fix to give back error when path not found
  • Loading branch information
goccy authored Feb 2, 2021
2 parents f6ab5cc + e838d7c commit d984d1d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion path.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var (
ErrInvalidQuery = xerrors.New("invalid query")
ErrInvalidPath = xerrors.New("invalid path instance")
ErrInvalidPathString = xerrors.New("invalid path string")
ErrNotFoundNode = xerrors.New("node not found")
)

// PathString create Path from string
Expand Down Expand Up @@ -214,7 +215,7 @@ func (p *Path) FilterFile(f *ast.File) (ast.Node, error) {
return node, nil
}
}
return nil, nil
return nil, errors.Wrapf(ErrNotFoundNode, "failed to find path ( %s )", p.node)
}

// FilterNode filter from node by YAMLPath.
Expand Down

0 comments on commit d984d1d

Please sign in to comment.