Skip to content

Commit

Permalink
Better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Dec 21, 2022
1 parent e807813 commit 00fb3c8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/HaskellWorks/CabalCache/Concurrent/DownloadQueue.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,16 @@ runQueue downloadQueue f = do
Just packageId -> do
downloadStatus <- f packageId
& do CMC.handleAll \e -> do
liftIO $ CIO.hPutStrLn IO.stderr $ "Warning: Unexpected exception during download: " <> tshow e
liftIO $ CIO.hPutStrLn IO.stderr $ "Warning: Unexpected exception during download of " <> packageId <> ": " <> tshow e
liftIO $ IO.hFlush IO.stderr
pure DownloadFailure
case downloadStatus of
DownloadSuccess -> do liftIO $ STM.atomically $ commit downloadQueue packageId
DownloadFailure -> do liftIO $ STM.atomically $ failDownload downloadQueue packageId
DownloadSuccess -> do
liftIO $ CIO.hPutStrLn IO.stderr $ "Downloaded " <> packageId
liftIO $ STM.atomically $ commit downloadQueue packageId
DownloadFailure -> do
liftIO $ CIO.hPutStrLn IO.stderr $ "Failed to download " <> packageId
liftIO $ STM.atomically $ failDownload downloadQueue packageId
runQueue downloadQueue f

Nothing -> return ()

0 comments on commit 00fb3c8

Please sign in to comment.