Open djg123 opened 10 years ago
Ugh. fromUrl
just uses HXT's readDocument
function (link), which in turn uses the HTTP package, which in this case just dies on an error. You can switch to using a combination of openUrl
and parseHtml
instead, something like:
contents <- runMaybeT $ openUrl "http://foo.com"
case contents of
Nothing -> ...
Just val -> parseHtml val
Long term I should probably switch the implementation of fromUrl
to something like this too.
I got the following error after calling
fromUrl
:Main.hs: <socket: 9>: hGetBufSome: timeout (Connection timed out)
, and then my program died.This error makes sense, but is it documented? I would like a way to handle it within my code instead of my program dying.