Improve debugging output (#2281)

* Improve debugging output

Displaying the exception makes it easier to figure out what is going
wrong.

I’ve also added a HasCallStack constraint to `locateRunfiles` since it
looked like that was failing. Turned out to be a call to `create` that
didn’t go via `locateRunfiles` but I think it’s useful either way.
Should be more useful with https://github.com/tweag/rules_haskell/pull/1007

* Update compiler/hie-core/src/Development/IDE/Core/Shake.hs

Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
This commit is contained in:
Moritz Kiefer 2019-07-25 12:33:58 +02:00 committed by Gary Verhaegen
parent e41f17c969
commit 8ab246bcdb

View File

@ -50,7 +50,6 @@ import qualified Data.ByteString.Char8 as BS
import Data.Dynamic
import Data.Maybe
import Data.Map.Strict (Map)
import Data.Either.Extra
import Data.List.Extra
import qualified Data.Set as Set
import qualified Data.Text as T
@ -340,8 +339,11 @@ shakeRun IdeState{shakeExtras=ShakeExtras{..}, ..} acts = modifyVar shakeAbort $
thread <- forkFinally (shakeRunDatabaseProfile shakeDb acts) $ \res -> do
signalBarrier bar res
runTime <- start
let res' = case res of
Left e -> "exception: " <> displayException e
Right _ -> "completed"
logDebug logger $ T.pack $
"Finishing shakeRun (took " ++ showDuration runTime ++ ", " ++ (if isLeft res then "exception" else "completed") ++ ")"
"Finishing shakeRun (took " ++ showDuration runTime ++ ", " ++ res' ++ ")"
-- important: we send an async exception to the thread, then wait for it to die, before continuing
return (do killThread thread; void $ waitBarrier bar, either throwIO return =<< waitBarrier bar)