The current IOException thrown by network is too poor.
For instance, bind does not tell which port is already used.
Let's enrich IOException.
The definition is here:
data IOException
= IOError {
ioe_handle :: Maybe Handle, -- the handle used by the action flagging
-- the error.
ioe_type :: IOErrorType, -- what it was.
ioe_location :: String, -- location.
ioe_description :: String, -- error type specific information.
ioe_errno :: Maybe CInt, -- errno leading to this error, if any.
ioe_filename :: Maybe FilePath -- filename the error is related to.
}
Show is here:
instance Show IOException where
showsPrec p (IOError hdl iot loc s _ fn) =
(case fn of
Nothing -> case hdl of
Nothing -> id
Just h -> showsPrec p h . showString ": "
Just name -> showString name . showString ": ") .
(case loc of
"" -> id
_ -> showString loc . showString ": ") .
showsPrec p iot .
(case s of
"" -> id
_ -> showString " (" . showString s . showString ")")
ieo_errno is set but it's not displayed.
So, ioe_description should include it.
The current
IOExceptionthrown bynetworkis too poor.For instance,
binddoes not tell which port is already used.Let's enrich
IOException.The definition is here:
Showis here:ieo_errnois set but it's not displayed.So,
ioe_descriptionshould include it.