on master help sign in
Improve Loopback error message
dc6668dEvan Czaplicki
src/Type/ExtraChecks.hs+12−5
@@ -231,12 +231,12 @@ wireError
231 -> [P.Doc]
231 -> [P.Doc]
232wireError name direction rootType localType problemMessage =
232wireError name direction rootType localType problemMessage =
233 [ P.text (dir "Input" "Output" ++ " Error:")
233 [ P.text (dir "Input" "Output" ++ " Error:")
234− , P.nest 2 $
234+ , P.nest 4 $
235 P.vcat
235 P.vcat
236− [ txt [ "The ", wire, " named '", name, "' was has an invalid type.\n" ]
236+ [ txt [ "The ", wire, " named '", name, "' has an invalid type.\n" ]
237− , P.nest 2 (PP.pretty rootType) <> P.text "\n"
237+ , P.nest 4 (PP.pretty rootType) <> P.text "\n"
238 , txt [ problemMessage, ":\n" ]
238 , txt [ problemMessage, ":\n" ]
239− , P.nest 2 (PP.pretty localType) <> P.text "\n"
239+ , P.nest 4 (PP.pretty localType) <> P.text "\n"
240 , txt [ "Acceptable values for ", wire, "s include:" ]
240 , txt [ "Acceptable values for ", wire, "s include:" ]
241 , txt [ " Ints, Floats, Bools, Strings, Maybes, Lists, Arrays, Tuples, unit values," ]
241 , txt [ " Ints, Floats, Bools, Strings, Maybes, Lists, Arrays, Tuples, unit values," ]
242 , txt [ " Json.Values, ", dir "" "first-order functions, promises, ", "and concrete records." ]
242 , txt [ " Json.Values, ", dir "" "first-order functions, promises, ", "and concrete records." ]
@@ -274,7 +274,14 @@ checkLoobacksHelp name rootType tipe hasExpr =
274 return ()
274 return ()
275
275
276 _ ->
276 _ ->
277− throw [ P.text "no good loopback" ]
277+ throw $
278+ [ P.text "Loopback Error:"
279+ , P.nest 4 $
280+ P.vcat
281+ [ P.text ("The loopback named '" ++ name ++ "' has an invalid type.\n")
282+ , P.nest 4 (PP.pretty rootType) <> P.text "\n"
283+ ]
284+ ]
278
285
279
286
280-- INFINITE TYPES
287-- INFINITE TYPES