More error information when Haddock unpacking fails

This commit is contained in:
Michael Snoyman 2015-03-25 15:31:33 +02:00
parent 55a5107657
commit da1b63ba9b
2 changed files with 25 additions and 9 deletions

View File

@ -7,6 +7,8 @@ module Data.Unpacking
, createHoogleDatabases
) where
import Control.Concurrent.Async
import Data.Conduit.Process
import Import hiding (runDB)
import Data.BlobStore
import Handler.Haddock
@ -147,13 +149,22 @@ unpackRawDocsTo store ident say destdir =
createTree destdir
say "Unpacking tarball"
(Nothing, Nothing, Nothing, ph) <- createProcess
(proc "tar" ["xf", tempfp])
{ cwd = Just $ fpToString destdir
}
ec <- waitForProcess ph
if ec == ExitSuccess then return () else throwM ec
(ClosedStream, out, err, cph) <- streamingProcess (proc "tar" ["xf", tempfp])
{ cwd = Just $ fpToString destdir
}
(ec, out', err') <- liftIO $ runConcurrently $ (,,)
<$> Concurrently (waitForStreamingProcess cph)
<*> Concurrently (out $$ foldC)
<*> Concurrently (err $$ foldC)
unless (ec == ExitSuccess) $ throwM
$ HaddockBundleUnpackException ec out' err'
data HaddockBundleUnpackException = HaddockBundleUnpackException
!ExitCode
!ByteString
!ByteString
deriving (Show, Typeable)
instance Exception HaddockBundleUnpackException
unpacker
:: Dirs

View File

@ -51,6 +51,11 @@ requireDocs stackageEnt = do
<p>This page will automatically reload every second.
<p>Current status: #{msg}
|]
USFailed e -> invalidArgs
[ "Docs not available: " ++ e
]
USFailed e -> do
$logWarn $ "Docs not available: " ++ tshow
( stackageSlug $ entityVal stackageEnt
, e
)
invalidArgs
[ "Docs not available: " ++ e
]