1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Reporting.Error.Http
12import qualified Data.Text as Text
13import Text.PrettyPrint.ANSI.Leijen ((<>))
14import qualified Text.PrettyPrint.ANSI.Leijen as P
16import qualified Reporting.Error.Help as Help
27 | BadZipSha String String
34toReport :: String -> Error -> Help.Report
38 P.indent 4 $ P.dullyellow $ "<" <> P.text url <> ">"
42 Help.report "HTTP PROBLEM" Nothing "The following HTTP request failed:"
45 [ "Here is the error message I was able to extract:"
46 , P.indent 4 $ Help.reflow message
50 BadJson jsonErrorDoc ->
51 Help.compilerReport jsonErrorDoc
54 Help.report "CORRUPT ZIP" Nothing "I could not unzip the file downloaded from:"
57 "If it is a transient issue, it should be fixed if you try this\
58 \ again. If it seems like an Elm problem, please report it though!"
61 BadZipSha expectedHash actualHash ->
62 Help.report "CORRUPT ZIP" Nothing "I got an unexpected zip file from:"
65 "I was expecting the hash of content to be " ++ expectedHash
66 ++ ", but it is " ++ actualHash
68 "Most likely the package author may have moved the version\
69 \ tag, so report it to them and see if that is the issue."
79 | BadAllPkg Text.Text String
83badJsonToDocs :: BadJson -> [P.Doc]
84badJsonToDocs badJson =
87 ["I","ran","into",P.red (P.text (show txt)) <> ","
88 ,"but","I","need","entries","like"
89 ,P.green "\"elm-lang/core@6.0.0\"" <> "."
92 BadAllPkg txt suggestion ->
93 ["The",P.red (P.text (show txt)),"value","is","not","a","valid","package","name."
95 ++ map P.text (words suggestion)
98 ["You","provided",P.red (P.text (show txt))
99 ,"which","is","not","a","valid","version.","I","need","something","like"
100 ,P.green "\"1.0.0\"","or",P.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