on master help sign in
Fix how compiler errors are displayed in generated HTML
commitf625a9c7d6f7f3acfca0431eca714ab92fe91b0a authorevancz <info@elm-lang.org> dateFri 5 Apr 2013, 09:51 (14 years ago) parent1af2ff9
1 file changed+3−1
compiler/Gen/CompileToJS.hs+3−1
compiler/Gen/CompileToJS.hs+3−1
@@ -18,8 +18,10 @@ import Rename (deprime)
1818import Types.Types ( Type(RecordT) )
1919
2020showErr :: String -> String
21−showErr err = "Elm.Graphics.text(Elm.Text.monospace(" ++ msg ++ "))"
21+showErr err = globalAssign "Elm.Main" (jsFunc "elm" body)
2222 where msg = show . concatMap (++"<br>") . lines $ err
23+ body = "var T = Elm.Graphics.Text(elm);\n\
24+ \return { main : T.text(T.monospace(" ++ msg ++ ")) };"
2325
2426indent = concatMap f
2527 where f '\n' = "\n "