Skip to content

Commit

Permalink
Improve Soup.($) exception message
Browse files Browse the repository at this point in the history
Fixes #22.
  • Loading branch information
aantron committed Oct 9, 2018
1 parent c4ffd2f commit fd80378
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/soup.ml
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,10 @@ let select_one selector node = select selector node |> first

let ($) node selector =
node |> select_one selector
|> require_internal (Printf.sprintf "Soup.($): cannot select '%s'" selector)
|> require_internal
(Printf.sprintf "Soup.($): '%s' not found.\n%s"
selector
"Try Soup.($?) if you'd prefer returning None instead of an exception.")

let ($?) node selector = node |> select_one selector

Expand Down

0 comments on commit fd80378

Please sign in to comment.