mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-11 19:58:28 +01:00
More error information when Haddock unpacking fails
This commit is contained in:
parent
55a5107657
commit
da1b63ba9b
@ -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
|
||||
|
||||
11
Import.hs
11
Import.hs
@ -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
|
||||
]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user