Skip to content

Commit afb1867

Browse files
authored
Merge pull request #6715 from commercialhaskell/re6711-2
Re #6711 Add debug info to copyPreCompiled
2 parents 3fbb1e1 + 544cb67 commit afb1867

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

doc/maintainers/stack_errors.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ to take stock of the errors that Stack itself can raise, by reference to the
4646
[S-1727] = NotOnlyLocal [PackageName] [Text]
4747
~~~
4848

49+
- `Stack.Build.ExecutePackage`
50+
51+
`[S-4541]` used in `copyPreCompiled`
52+
4953
- `Stack.BuildPlan.BuildPlanException`
5054

5155
~~~haskell

src/Stack/Build/ExecutePackage.hs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,9 +869,23 @@ copyPreCompiled ee task pkgId (PrecompiledCache mlib subLibs exes) = do
869869
(unregisterGhcPkgIds False ghcPkgExe pkgDb allToUnregister')
870870
(const (pure ()))
871871
-- Now, register the cached conf files.
872-
forM_ allToRegister $ \libpath ->
873-
ghcPkg ghcPkgExe [pkgDb] ["register", "--force", toFilePath libpath]
874-
872+
forM_ allToRegister $ \libpath -> do
873+
let args = ["register", "--force", toFilePath libpath]
874+
eres <- ghcPkg ghcPkgExe [pkgDb] args
875+
case eres of
876+
Left e -> prettyWarn $
877+
"[S-4541]"
878+
<> line
879+
<> fillSep
880+
[ flow "While registering"
881+
, pretty libpath
882+
, "in"
883+
, pretty pkgDb <> ","
884+
, flow "Stack encountered the following error:"
885+
]
886+
<> blankLine
887+
<> string (displayException e)
888+
Right _ -> pure ()
875889
liftIO $ forM_ exes $ \exe -> do
876890
ensureDir bindir
877891
let dst = bindir </> filename exe

0 commit comments

Comments
 (0)