withCatch :: IO () -> IO ()
withCatch todo = catch todo recover
  where
    recover :: IOError -> IO ()
    recover e = fatal $ intercalate "\n" ["Runtime error:", "  " ++ show e]

-- Execute a given IO action and logs the given message, if wanted.
withCatch :: IO () -> IO ()
withCatch todo = catch todo recover
  where
    recover :: IOError -> IO ()
    recover e = fatal $ intercalate "\n" ["Runtime error:", "  " ++ show e]

-- Execute a given IO action and logs the given message, if wanted.
withCatch todo = catch todo recover
  where
    recover :: IOError -> IO ()
    recover e = fatal $ intercalate "\n" ["Runtime error:", "  " ++ show e]

-- Execute a given IO action and logs the given message, if wanted.