Skip to content
Snippets Groups Projects
Commit 125714a6 authored by Ben Gamari's avatar Ben Gamari
Browse files

base: Factor out errorBelch

This was useful when debugging
parent 3e5c9e3c
No related branches found
No related tags found
No related merge requests found
......@@ -216,13 +216,17 @@ real_handler exit se = do
-- don't use errorBelch() directly, because we cannot call varargs functions
-- using the FFI.
foreign import ccall unsafe "HsBase.h errorBelch2"
errorBelch :: CString -> CString -> IO ()
c_errorBelch :: CString -> CString -> IO ()
errorBelch :: String -> IO ()
errorBelch msg =
withCAString "%s" $ \fmt ->
withCAString msg $ \msg' ->
c_errorBelch fmt msg'
disasterHandler :: (Int -> IO a) -> IOError -> IO a
disasterHandler exit _ =
withCAString "%s" $ \fmt ->
withCAString msgStr $ \msg ->
errorBelch fmt msg >> exit 1
errorBelch msgStr >> exit 1
where
msgStr =
"encountered an exception while trying to report an exception.\n" ++
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment