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

View File

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