  = flip catch handleTLSHandshakeFailed $
      flip catch handleIOException $
        http request manager
  where
    handleIOException (e :: IOException) = throwIO 
      $ FailedConnectionException 
          (unpack $ decodeUtf8 $ host request) 
          (port request)
    handleTLSHandshakeFailed (e :: TLS.HandshakeFailed) = throwIO 
      $ FailedConnectionException 
          (unpack $ decodeUtf8 $ host request) 