on master help sign in
add error messages for problems loading docs.json
075be13Evan Czaplicki
builder/src/Deps/Diff.hs+1−1
@@ -380,4 +380,4 @@ getDocs cache manager name version =
380 return $ Right docs
380 return $ Right docs
381
381
382 Left _ ->
382 Left _ ->
383− return $ Left Exit.DP_Data
383+ return $ Left $ Exit.DP_Data url body
builder/src/Reporting/Exit.hs+48−10
@@ -130,7 +130,7 @@ data Diff
130 | DiffUnpublished
130 | DiffUnpublished
131 | DiffUnknownPackage Pkg.Name [Pkg.Name]
131 | DiffUnknownPackage Pkg.Name [Pkg.Name]
132 | DiffUnknownVersion Pkg.Name V.Version [V.Version]
132 | DiffUnknownVersion Pkg.Name V.Version [V.Version]
133− | DiffDocsProblem DocsProblem
133+ | DiffDocsProblem V.Version DocsProblem
134 | DiffMustHaveLatestRegistry RegistryProblem
134 | DiffMustHaveLatestRegistry RegistryProblem
135 | DiffBadDetails Details
135 | DiffBadDetails Details
136 | DiffBadBuild BuildProblem
136 | DiffBadBuild BuildProblem
@@ -198,8 +198,9 @@ diffToReport diff =
198 , "Want one of those instead?"
198 , "Want one of those instead?"
199 ]
199 ]
200
200
201− DiffDocsProblem problem ->
201+ DiffDocsProblem version problem ->
202− error "TODO DiffDocsProblem" problem
202+ toDocsProblemReport problem $
203+ "I need the docs for " ++ V.toChars version ++ " to compute this diff"
203
204
204 DiffMustHaveLatestRegistry problem ->
205 DiffMustHaveLatestRegistry problem ->
205 toRegistryProblemReport "PROBLEM UPDATING PACKAGE LIST" problem $
206 toRegistryProblemReport "PROBLEM UPDATING PACKAGE LIST" problem $
@@ -266,8 +267,9 @@ bumpToReport bump =
266 toRegistryProblemReport "PROBLEM UPDATING PACKAGE LIST" problem $
267 toRegistryProblemReport "PROBLEM UPDATING PACKAGE LIST" problem $
267 "I need the latest list of published packages before I can bump any versions"
268 "I need the latest list of published packages before I can bump any versions"
268
269
269− BumpCannotFindDocs name version problem ->
270+ BumpCannotFindDocs _ version problem ->
270− error "TODO BumpCannotFindDocs" name version problem
271+ toDocsProblemReport problem $
272+ "I need the docs for " ++ V.toChars version ++ " to compute the next version number"
271
273
272
274
273
275
@@ -317,7 +319,7 @@ data Publish
317 | PublishCannotGetTag Http.Error
319 | PublishCannotGetTag Http.Error
318 | PublishCannotGetZip Http.Error
320 | PublishCannotGetZip Http.Error
319 | PublishCannotDecodeZip
321 | PublishCannotDecodeZip
320− | PublishCannotGetDocs DocsProblem
322+ | PublishCannotGetDocs V.Version V.Version DocsProblem
321 | PublishCannotRegister Http.Error
323 | PublishCannotRegister Http.Error
322 | PublishMissingTag V.Version
324 | PublishMissingTag V.Version
323 | PublishNoGit
325 | PublishNoGit
@@ -491,8 +493,10 @@ publishToReport publish =
491 PublishCannotDecodeZip ->
493 PublishCannotDecodeZip ->
492 error "TODO PublishCannotDecodeZip"
494 error "TODO PublishCannotDecodeZip"
493
495
494− PublishCannotGetDocs docsProblem ->
496+ PublishCannotGetDocs old new docsProblem ->
495− error "TODO PublishCannotGetDocs" docsProblem
497+ toDocsProblemReport docsProblem $
498+ "I need the docs for " ++ V.toChars old ++ " to verify that "
499+ ++ V.toChars new ++ " really does come next"
496
500
497 PublishCannotRegister httpError ->
501 PublishCannotRegister httpError ->
498 error "TODO PublishCannotRegister" httpError
502 error "TODO PublishCannotRegister" httpError
@@ -587,10 +591,44 @@ toBadReadmeReport title summary =
587
591
588data DocsProblem
592data DocsProblem
589 = DP_Http Http.Error
593 = DP_Http Http.Error
590− | DP_Data
594+ | DP_Data String BS.ByteString
591 | DP_Cache
595 | DP_Cache
592
596
593
597
598+toDocsProblemReport :: DocsProblem -> String -> Help.Report
599+toDocsProblemReport problem context =
600+ case problem of
601+ DP_Http httpError ->
602+ toHttpErrorReport "PROBLEM FETCHING DOCS" httpError context
603+
604+ DP_Data url body ->
605+ Help.report "PROBLEM FETCHING DOCS" Nothing (context ++ ", so I fetched:")
606+ [ D.indent 4 $ D.dullyellow $ D.fromChars url
607+ , D.reflow $
608+ "I got the data back, but it was not what I was expecting. The response\
609+ \ body contains " ++ show (BS.length body) ++ " bytes. Here is the "
610+ ++ if BS.length body <= 76 then "whole thing:" else "beginning:"
611+ , D.indent 4 $ D.dullyellow $ D.fromChars $
612+ if BS.length body <= 76
613+ then BS_UTF8.toString body
614+ else take 73 (BS_UTF8.toString body) ++ "..."
615+ , D.reflow $
616+ "Does this error keep showing up? Maybe there is something weird with your\
617+ \ internet connection. We have gotten reports that schools, businesses,\
618+ \ airports, etc. sometimes intercept requests and add things to the body\
619+ \ or change its contents entirely. Could that be the problem?"
620+ ]
621+
622+ DP_Cache ->
623+ Help.report "PROBLEM LOADING DOCS" Nothing (context ++ ", but the local copy seems to be corrupted.")
624+ [ D.reflow $
625+ "I deleted the cached version, so the next run should download a fresh copy of\
626+ \ the docs. Hopefully that will get you unstuck, but it will not resolve the root\
627+ \ problem if, for example, a 3rd party editor plugin is modifing cached files\
628+ \ for some reason."
629+ ]
630+
631+
594
632
595-- INSTALL
633-- INSTALL
596
634
@@ -793,7 +831,7 @@ toHttpErrorReport title err context =
793 , D.indent 4 $ D.fromChars reason
831 , D.indent 4 $ D.fromChars reason
794 , D.reflow $
832 , D.reflow $
795 "This may indicate that there is some problem in the compiler, so please open an\
833 "This may indicate that there is some problem in the compiler, so please open an\
796− \ issue at https://github.com/elm/compiler/issues listing your operating system\
834+ \ issue at https://github.com/elm/compiler/issues listing your operating system, Elm\
797 \ version, the command you ran, the terminal output, and any additional information\
835 \ version, the command you ran, the terminal output, and any additional information\
798 \ that might help others reproduce the error."
836 \ that might help others reproduce the error."
799 ]
837 ]