Hi Mike,
First, if you don't know how wreq acts when it gets invalid url – I suggest just launching repl and checking that out. I'll show how to do that using
haskell stack tool:
➜ ~ stack install wreq
...
➜ ~ stack ghci
Run from outside a project, using implicit global config
Using resolver: lts-3.5 from global config file: /Users/kb/.stack/global/stack.yaml
Configuring GHCi with the following packages:
λ import Network.Wreq
λ get "nonvalid"
*** Exception: InvalidUrlException "nonvalid" "Invalid URL"
You see, it throws InvalidUrlException upon request, which you can catch and render an error.
Now, to get content, as per tutorial, just do:
λ import Control.Lens
... (long binary response goes into your output) ...
That's it. Last thing I should mention – errors which can be thrown are all just HttpException type.
Go and see possible ones, some of which you might want to handle specifically, while others just in a generic "something bad happened" error.
Hope this helps.