on master help sign in
add real error messages for two scenarios in `elm install`
commit783e7b9a84c472fc56d75849b92535ff28972034 authorEvan Czaplicki <evancz@users.noreply.github.com> dateTue 18 Jun 2019, 17:19 (7 years ago) parent8e2b63e
2 files changed+14−22
builder/src/Reporting/Exit.hs+11−2 terminal/src/Install.hs+3−20
builder/src/Reporting/Exit.hs+11−2
@@ -695,7 +695,9 @@ toDocsProblemReport problem context =
695695
696696
697697data Install
698− = InstallNoProject
698+ = InstallNoOutline
699+ | InstallBadOutline Outline
700+ | InstallBadRegistry RegistryProblem
699701 | InstallNoArgs FilePath
700702 | InstallNoOnlineSolution
701703 | InstallNoOfflineSolution
@@ -708,13 +710,20 @@ data Install
708710installToReport :: Install -> Help.Report
709711installToReport exit =
710712 case exit of
711− InstallNoProject ->
713+ InstallNoOutline ->
712714 Help.report "NEW PROJECT?" Nothing
713715 "Are you trying to start a new project? Try this command instead:"
714716 [ D.indent 4 $ D.green "elm init"
715717 , D.reflow "It will help you get started!"
716718 ]
717719
720+ InstallBadOutline outline ->
721+ toOutlineReport outline
722+
723+ InstallBadRegistry problem ->
724+ toRegistryProblemReport "PROBLEM LOADING PACKAGE LIST" problem $
725+ "I need the list of published packages to figure out how to install things"
726+
718727 InstallNoArgs elmHome ->
719728 Help.report "INSTALL WHAT?" Nothing
720729 "I am expecting commands like:"
terminal/src/Install.hs+3−20
@@ -40,7 +40,7 @@ run args () =
4040 do maybeRoot <- Stuff.findRoot
4141 case maybeRoot of
4242 Nothing ->
43− return (Left Exit.InstallNoProject)
43+ return (Left Exit.InstallNoOutline)
4444
4545 Just root ->
4646 case args of
@@ -50,8 +50,8 @@ run args () =
5050
5151 Install pkg ->
5252 Task.run $
53− do env <- getEnv
54− oldOutline <- getOutline root
53+ do env <- Task.eio Exit.InstallBadRegistry $ Solver.initEnv
54+ oldOutline <- Task.eio Exit.InstallBadOutline $ Outline.read root
5555 case oldOutline of
5656 Outline.App outline ->
5757 do changes <- makeAppPlan env pkg outline
@@ -63,23 +63,6 @@ run args () =
6363
6464
6565
66−getEnv :: Task Solver.Env
67−getEnv =
68− do eitherEnv <- Task.io Solver.initEnv
69− case eitherEnv of
70− Right env -> return env
71− Left problem -> Task.throw (error "TODO getEnv" problem)
72−
73−
74−getOutline :: FilePath -> Task Outline.Outline
75−getOutline root =
76− do eitherOutline <- Task.io (Outline.read root)
77− case eitherOutline of
78− Right outline -> return outline
79− Left exit -> Task.throw (error "TODO getOutline" exit)
80−
81−
82−
8366-- ATTEMPT CHANGES
8467
8568