Skip to content

Commit

Permalink
Improve error message when json path selector doesn't match
Browse files Browse the repository at this point in the history
  • Loading branch information
Stein Fletcher committed Jun 4, 2020
1 parent 3b704ba commit 5e25fad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ go 1.13

require (
github.com/PaesslerAG/jsonpath v0.1.1
github.com/steinfletcher/apitest v1.4.6
github.com/stretchr/testify v1.5.1
github.com/steinfletcher/apitest v1.4.8
github.com/stretchr/testify v1.6.0
)
14 changes: 6 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/steinfletcher/apitest v1.4.5 h1:BfKcS94yzsXomRV0Ojto999uziGGEz+AHh0iQWxrtu0=
github.com/steinfletcher/apitest v1.4.5/go.mod h1:yaYc9GDlj4fa0qUUDywqAmrELlNbDrBwd36Zgo5hMZo=
github.com/steinfletcher/apitest v1.4.6 h1:7IhnjUVTdKdNIhsHskIDNhN5JJbxuv1+e42LFDSxnjI=
github.com/steinfletcher/apitest v1.4.6/go.mod h1:yaYc9GDlj4fa0qUUDywqAmrELlNbDrBwd36Zgo5hMZo=
github.com/steinfletcher/apitest v1.4.8 h1:9SDVm1MCv6FRCd8xuGgoZA0TCsunN0TrXBon+ZL86wE=
github.com/steinfletcher/apitest v1.4.8/go.mod h1:3nIZfM9GDQWGP9UGx6Zxk+LXc0DZFcZvy6+LfdhZa6U=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.0 h1:jlIyCplCJFULU/01vCkhKuTyc3OorI3bJFuw6obfgho=
github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion jsonpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func jsonPath(reader io.Reader, expression string) (interface{}, error) {

value, err := jsonpath.Get(expression, v)
if err != nil {
return nil, err
return nil, fmt.Errorf("evaluating '%s' resulted in error: '%s'", expression, err)
}
return value, nil
}
Expand Down

0 comments on commit 5e25fad

Please sign in to comment.