Skip to content

Commit b0a036e

Browse files
committed
Add rough reason context to DetailsHandEditedDependencies
1 parent e8342a9 commit b0a036e

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

builder/src/Elm/Details.hs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ verifyApp env time outline@(Outline.AppOutline elmVersion srcDirs direct _ _ _)
253253
if Map.size stated == Map.size actual
254254
then verifyDependencies env time (ValidApp srcDirs) actual direct
255255
else Task.throw $ Exit.DetailsHandEditedDependencies
256+
$ "The stated and actual dependencies do not match.\n\n"
257+
++ "Stated: " ++ show stated ++ "\n\nActual: " ++ show actual
256258
else
257259
Task.throw $ Exit.DetailsBadElmInAppOutline elmVersion
258260

@@ -289,14 +291,17 @@ union tieBreaker deps1 deps2 =
289291

290292
noDups :: k -> v -> v -> Task v
291293
noDups _ _ _ =
292-
Task.throw Exit.DetailsHandEditedDependencies
294+
Task.throw $ Exit.DetailsHandEditedDependencies
295+
"The same dependency is listed in multiple places in your elm.json file."
293296

294297

295-
allowEqualDups :: (Eq v) => k -> v -> v -> Task v
298+
allowEqualDups :: (Eq v, Show v) => k -> v -> v -> Task v
296299
allowEqualDups _ v1 v2 =
297300
if v1 == v2
298301
then return v1
299-
else Task.throw Exit.DetailsHandEditedDependencies
302+
else Task.throw $ Exit.DetailsHandEditedDependencies
303+
$ "The same dependency is listed in multiple places in your elm.json file, but with different constraints.\n\n"
304+
++ "Dep 1: " ++ show v1 ++ "\n\nDep 2: " ++ show v2
300305

301306

302307

builder/src/Reporting/Exit.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,7 @@ data Details
12811281
| DetailsBadElmInPkg C.Constraint
12821282
| DetailsBadElmInAppOutline V.Version
12831283
| DetailsHandEditedDependencies
1284+
String -- @LAMDERA addition: reason
12841285
| DetailsBadOutline Outline
12851286
| DetailsCannotGetRegistry RegistryProblem
12861287
| DetailsBadDeps FilePath [DetailsBadDep]
@@ -1356,11 +1357,13 @@ toDetailsReport details =
13561357
, D.reflow $ "Lamdera hint: modify your elm.json to \"elm-version\": \"0.19.1\"."
13571358
]
13581359

1359-
DetailsHandEditedDependencies ->
1360+
DetailsHandEditedDependencies reason ->
13601361
Help.report "ERROR IN DEPENDENCIES" (Just "elm.json")
13611362
"It looks like the dependencies elm.json in were edited by hand (or by a 3rd\
13621363
\ party tool) leaving them in an invalid state."
1363-
[ D.fillSep
1364+
[ D.reflow $
1365+
"Reason: " ++ reason
1366+
, D.fillSep
13641367
["Try","to","change","them","back","to","what","they","were","before!"
13651368
,"It","is","much","more","reliable","to","add","dependencies","with",D.green "lamdera install" <> "."
13661369
]

0 commit comments

Comments
 (0)