Uncatchable error (fwd)

Henning Thielemann lemming at henning-thielemann.de
Sat Mar 12 01:32:43 CET 2011

I like to forward this message from Haskell-Cafe:

---------- Forwarded message ----------
Date: Fri, 11 Mar 2011 17:04:16 +0100 (CET)
From: Daniel Díaz <danieldiaz at asofilak.es>
To: haskell-cafe at haskell.org
Subject: [Haskell-cafe] Uncatchable error

Hi, cafe,

I'm working in a program where I use many connections with Network.HTTP.
Sometimes, connections are closed while my program is reading them, and an
error appears:

<socket: XXX>: Data.ByteString.hGetLine: invalid argument (Bad file

All I need is to handle this error. The function 'catch' doesn't work. I
guess this error comes from a call to 'error' function, or something

What I can do?

Thanks in advance,
Daniel Díaz


It sounds to me that this is not a particular problem of Network.HTTP or 
Data.ByteString.hGetLine. It would certainly also happen for 
System.IO.hGetLine applied to a HTTP stream. So how can exceptions about 
closed HTTP connections be caught and where is it documented? The 
System.IO functions only mention EOF as possible exception.

More information about the Libraries mailing list