Commit 4de99957 authored by Duncan Coutts's avatar Duncan Coutts Committed by GitHub
Browse files

Merge pull request #3817 from ezyang/pr/dump-fail-msg

Give more informative error when ghc-pkg dump fails.
parents d1d9737c 7384c05a
{-# LANGUAGE CPP #-}
module Distribution.Compat.Exception (
catchIO,
catchExit,
tryIO,
displayException,
) where
import System.Exit
import qualified Control.Exception as Exception
#if __GLASGOW_HASKELL__ >= 710
import Control.Exception (displayException)
#endif
tryIO :: IO a -> IO (Either Exception.IOException a)
tryIO = Exception.try
......@@ -15,3 +20,8 @@ catchIO = Exception.catch
catchExit :: IO a -> (ExitCode -> IO a) -> IO a
catchExit = Exception.catch
#if __GLASGOW_HASKELL__ < 710
displayException :: Exception.Exception e => e -> String
displayException = show
#endif
......@@ -234,7 +234,8 @@ dump hpi verbosity packagedb = do
output <- getProgramInvocationOutput verbosity
(dumpInvocation hpi verbosity packagedb)
`catchIO` \_ -> die $ programId (hcPkgProgram hpi) ++ " dump failed"
`catchIO` \e -> die $ programId (hcPkgProgram hpi) ++ " dump failed: "
++ displayException e
case parsePackages output of
Left ok -> return ok
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment