Commit 7a8d9c07 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

Improve an error message.

See #1362.
parent e2b4aa49
......@@ -173,7 +173,7 @@ install verbosity packageDBs repos comp platform conf useSandbox mSandboxPkgInfo
userTargets0 = do
installContext <- makeInstallContext verbosity args (Just userTargets0)
installPlan <- foldProgress logMsg die return =<<
installPlan <- foldProgress logMsg die' return =<<
makeInstallPlan verbosity args installContext
processInstallPlan verbosity args installContext installPlan
......@@ -183,6 +183,14 @@ install verbosity packageDBs repos comp platform conf useSandbox mSandboxPkgInfo
globalFlags, configFlags, configExFlags, installFlags,
haddockFlags)
die' message = die (message ++ if isUseSandbox useSandbox
then installFailedInSandbox else [])
-- TODO: use a better error message, remove duplication.
installFailedInSandbox =
"Note: when using a sandbox, all packages are required to have \
\consistent dependencies. \
\Try reinstalling/unregistering the offending packages or \
\recreating the sandbox."
logMsg message rest = debugNoWrap verbosity message >> rest
-- TODO: Make InstallContext a proper datatype with documented fields.
......
......@@ -542,7 +542,7 @@ reinstallAddSourceDeps verbosity configFlags' configExFlags
-- might want to use some lower-level features this in the future.
withSandboxBinDirOnSearchPath sandboxDir $ do
installContext <- makeInstallContext verbosity args Nothing
installPlan <- foldProgress logMsg die return =<<
installPlan <- foldProgress logMsg die' return =<<
makeInstallPlan verbosity args installContext
processInstallPlan verbosity args installContext installPlan
......@@ -551,6 +551,13 @@ reinstallAddSourceDeps verbosity configFlags' configExFlags
readIORef retVal
where
die' message = die (message ++ installFailedInSandbox)
-- TODO: use a better error message, remove duplication.
installFailedInSandbox =
"Note: when using a sandbox, all packages are required to have \
\consistent dependencies. \
\Try reinstalling/unregistering the offending packages or \
\recreating the sandbox."
logMsg message rest = debugNoWrap verbosity message >> rest
topHandler' = topHandlerWith $ \_ -> do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment