Skip to content

Commit

Permalink
sim-net: improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
coot committed Oct 14, 2021
1 parent c8fc9a5 commit 2e6b125
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ouroboros-network-framework/src/Simulation/Network/Snocket.hs
Expand Up @@ -694,23 +694,23 @@ mkSnocket state tr = Snocket { getLocalAddr
fd <- atomically (readTVar fdVar)
case fd of
FDUninitialised {} ->
throwIO invalidError
throwIO (invalidError "uninitialised file descriptor")
FDListening {} ->
throwIO invalidError
throwIO (invalidError "listening snocket")
FDConnected _ conn -> do
traceWith tr (STBearer fd)
return $ attenuationChannelAsMuxBearer (connSDUSize conn)
sduTimeout muxTracer
(connChannelLocal conn)
FDClosed {} ->
throwIO invalidError
throwIO (invalidError "closed snocket")
where
-- io errors
invalidError = IOError
invalidError desc = IOError
{ ioe_handle = Nothing
, ioe_type = InvalidArgument
, ioe_location = "Ouroboros.Network.Snocket.Sim.toBearer"
, ioe_description = "Invalid argument"
, ioe_description = "Invalid argument: " ++ desc
, ioe_errno = Nothing
, ioe_filename = Nothing
}

0 comments on commit 2e6b125

Please sign in to comment.