1{-# LANGUAGE OverloadedStrings #-}
2module Reporting.Exit.Http
11import qualified Data.Text as Text
13import Reporting.Doc ((<>))
14import qualified Reporting.Doc as D
15import qualified Reporting.Exit.Help as Help
24 | BadJson String D.Doc
26 | BadZipSha String String
33toReport :: String -> Exit -> Help.Report
37 D.indent 4 $ D.dullyellow $ "<" <> D.fromString url <> ">"
41 Help.report "HTTP PROBLEM" Nothing "The following HTTP request failed:"
44 [ "Here is the error message I was able to extract:"
45 , D.indent 4 $ D.reflow message
50 Help.jsonReport "UNEXPECTED JSON" (Just path) doc
53 Help.report "CORRUPT ZIP" Nothing "I could not unzip the file downloaded from:"
56 "If it is a transient issue, it should be fixed if you try this\
57 \ again. If it seems like an Elm problem, please report it though!"
60 BadZipSha expectedHash actualHash ->
61 Help.report "CORRUPT ZIP" Nothing "I got an unexpected zip file from:"
64 "I was expecting the hash of content to be " ++ expectedHash
65 ++ ", but it is " ++ actualHash
67 "Most likely the package author may have moved the version\
68 \ tag, so report it to them and see if that is the issue."
78 | BadAllPkg Text.Text String
82badJsonToDocs :: BadJson -> [D.Doc]
83badJsonToDocs badJson =
86 ["I","ran","into",D.red (D.fromString (show txt)) <> ","
87 ,"but","I","need","entries","like"
88 ,D.green "\"elm-lang/core@6.0.0\"" <> "."
91 BadAllPkg txt suggestion ->
92 ["The",D.red (D.fromString (show txt)),"value","is","not","a","valid","package","name."
94 ++ map D.fromString (words suggestion)
97 ["You","provided",D.red (D.fromString (show txt))
98 ,"which","is","not","a","valid","version.","I","need","something","like"
99 ,D.green "\"1.0.0\"","or",D.green "\"2.0.4\"" <> "."
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list