on master help sign in
Give a nicer error message if certain bug manifests
commit39ae03c6da3c3a87b47d29d690fa6c70561e6a54 authorEvan Czaplicki <evancz@users.noreply.github.com> dateWed 29 Mar 2017, 17:14 (10 years ago) parentd715120
1 file changed+11−1
src/Generate/JavaScript.hs+11−1
src/Generate/JavaScript.hs+11−1
@@ -7,6 +7,7 @@ import Data.Monoid ((<>))
77import qualified Data.List as List
88import qualified Data.Map as Map
99import qualified Data.Set as Set
10+import qualified Data.Text as Text
1011import Data.Text (Text)
1112import qualified Data.ByteString.Builder as BS
1213
@@ -80,7 +81,7 @@ crawl graph state@(State js seen natives effects) name@(Var.Global home _) =
8081 if ModuleName.canonicalIsNative home then
8182 State js seen (Set.insert home natives) effects
8283 else
83− error "TODO something went wrong"
84+ error (crawlError name)
8485
8586
8687crawlDecl :: Graph -> Var.Global -> Opt.Decl -> State -> State
@@ -105,6 +106,15 @@ crawlDecl graph name@(Var.Global home _) (Opt.Decl deps mfx body) state =
105106 }
106107
107108
109+crawlError :: Var.Global -> String
110+crawlError (Var.Global (ModuleName.Canonical pkg home) name) =
111+ Text.unpack $
112+ "compiler bug manifesting in Generate.JavaScript\n"
113+ <> "could not find " <> Pkg.toText pkg <> " " <> ModuleName.toText home <> "." <> name <> "\n"
114+ <> "please report at <https://github.com/elm-lang/elm-compiler/issues>\n"
115+ <> "try to make an <http://sscce.org/> that demonstrates the issue!"
116+
117+
108118generateDecl :: Var.Global -> Opt.Def -> BS.Builder
109119generateDecl (Var.Global home name) def =
110120 let