on master help sign in
show more specific error on install problems

also, prioritize "corrupt downloads" over other kinds of build problems in the error messages

commit8eb44cb960a693394d02b2a68feec1654fb54966 authorEvan Czaplicki <evancz@users.noreply.github.com> dateSat 13 Jul 2019, 10:40 (7 years ago) parent71afb2f
2 files changed+12−17
builder/src/Reporting/Exit.hs+11−16 terminal/src/Install.hs+1−1
builder/src/Reporting/Exit.hs+11−16
@@ -751,7 +751,7 @@ data Install
751751 | InstallHadSolverTrouble Solver
752752 | InstallUnknownPackageOnline Pkg.Name [Pkg.Name]
753753 | InstallUnknownPackageOffline Pkg.Name [Pkg.Name]
754− | InstallHasBadDetails Pkg.Name Encode.Value
754+ | InstallBadDetails Details
755755
756756
757757installToReport :: Install -> Help.Report
@@ -895,20 +895,8 @@ installToReport exit =
895895 , D.reflow $ "Maybe you want one of these instead?"
896896 ]
897897
898− InstallHasBadDetails pkg outline ->
899− Help.report "INSTALL PROBLEM" Nothing
900− (
901− "I found a version of " ++ Pkg.toChars pkg ++ " that claims to be compatible with\
902− \ your existing dependencies, but I ran into an error when I tried to build it locally."
903− )
904− [ D.reflow $
905− "Here is an elm.json that should reproduce the error with a bit more information:"
906− , D.indent 4 $ D.dullyellow $ D.vcat $ map D.fromChars $
907− map BS_UTF8.toString $ BSC.lines $ LBS.toStrict $ B.toLazyByteString $
908− Encode.encode outline
909− , D.reflow $
910− "Maybe that can help figure out what is going on here."
911− ]
898+ InstallBadDetails details ->
899+ toDetailsReport details
912900
913901
914902
@@ -1334,7 +1322,7 @@ toDetailsReport details =
13341322 "I need the list of published packages to verify your dependencies"
13351323
13361324 DetailsBadDeps cacheDir deps ->
1337− case deps of
1325+ case List.sortOn toBadDepRank deps of
13381326 [] ->
13391327 Help.report "PROBLEM BUILDING DEPENDENCIES" Nothing
13401328 "I am not sure what is going wrong though."
@@ -1374,6 +1362,13 @@ toDetailsReport details =
13741362 ]
13751363
13761364
1365+toBadDepRank :: DetailsBadDep -> Int -- lower is better
1366+toBadDepRank badDep =
1367+ case badDep of
1368+ BD_BadDownload _ _ _ -> 0
1369+ BD_BadBuild _ _ _ -> 1
1370+
1371+
13771372
13781373-- PACKAGE PROBLEM
13791374
terminal/src/Install.hs+1−1
@@ -124,7 +124,7 @@ attemptChanges root env pkg oldOutline toChars changes =
124124
125125attemptChangesHelp :: FilePath -> Solver.Env -> Pkg.Name -> Outline.Outline -> Outline.Outline -> D.Doc -> Task ()
126126attemptChangesHelp root env pkg oldOutline newOutline question =
127− Task.eio (\_ -> Exit.InstallHasBadDetails pkg (Outline.encode newOutline)) $
127+ Task.eio Exit.InstallBadDetails $
128128 BW.withScope $ \scope ->
129129 do approved <- Reporting.ask question
130130 if approved